fix: fix button clear issue.

This commit is contained in:
rabbitism
2024-04-27 14:34:26 +08:00
parent 706147a6a7
commit af3b343550
3 changed files with 7 additions and 4 deletions

View File

@@ -19,6 +19,7 @@
PanelFormat="hh mm tt" />
<u:TimePicker
Width="300"
Classes="ClearButton"
DisplayFormat="HH 时 mm 分 ss 秒"
PanelFormat="HH mm ss tt"
HorizontalAlignment="Left"

View File

@@ -123,11 +123,10 @@
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}" />
<Grid ColumnDefinitions="*, Auto, Auto">
<Grid ColumnDefinitions="*, Auto">
<TextBox
Name="{x:Static u:TimePicker.PART_TextBox}"
Grid.Column="0"
Grid.ColumnSpan="2"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Background="Transparent"
@@ -172,7 +171,7 @@
Theme="{DynamicResource InnerIconButton}" />
<Button
Name="{x:Static u:TimePicker.PART_Button}"
Grid.Column="2"
Grid.Column="1"
Padding="0,0,8,0"
Content="{DynamicResource TimePickerIconGlyph}"
Focusable="False"
@@ -234,6 +233,9 @@
<Style Selector="^:pointerover /template/ Button#ClearButton">
<Setter Property="IsVisible" Value="{Binding $parent[u:TimePicker].SelectedTime, Converter={x:Static ObjectConverters.IsNotNull}}" />
</Style>
<Style Selector="^:pointerover /template/ Button#PART_Button">
<Setter Property="IsVisible" Value="{Binding $parent[u:TimePicker].SelectedTime, Converter={x:Static ObjectConverters.IsNull}}"/>
</Style>
</Style>
<Style Selector="^:pointerover">

View File

@@ -118,7 +118,7 @@ public class TimePicker : TemplatedControl, IClearControl, IInnerContentControl,
public void Clear()
{
SetCurrentValue(SelectedTimeProperty, null);
_presenter?.SetValue(TimePickerPresenter.TimeProperty, null);
}
public object? InnerLeftContent