fix: ClearButton will take the icon place when TextBox has value.

This commit is contained in:
Zhang Dian 2024-08-07 16:17:22 +08:00
parent 4b71b18e72
commit 7a6c42e106
2 changed files with 13 additions and 7 deletions

View File

@ -76,7 +76,7 @@
</TextBox>
<Button
Name="ClearButton"
Grid.Column="1"
Grid.Column="2"
Padding="0,0,8,0"
Content="{DynamicResource IconButtonClearData}"
Command="{Binding $parent[CalendarDatePicker].Clear}"
@ -122,10 +122,13 @@
</ControlTemplate>
</Setter>
<Style Selector="^.clearButton, ^.ClearButton">
<Style Selector="^:pointerover /template/ Button#ClearButton">
<Setter Property="IsVisible" Value="{Binding $parent[CalendarDatePicker].SelectedDate, Converter={x:Static ObjectConverters.IsNotNull}}"></Setter>
<Setter Property="IsVisible" Value="{Binding $parent[CalendarDatePicker].SelectedDate, Converter={x:Static ObjectConverters.IsNotNull}}" />
</Style>
<Style Selector="^:pointerover /template/ Button#PART_Button">
<Setter Property="IsVisible" Value="{Binding $parent[CalendarDatePicker].SelectedDate, Converter={x:Static ObjectConverters.IsNull}}" />
</Style>
</Style>

View File

@ -46,11 +46,11 @@
<Setter Property="Template">
<ControlTemplate TargetType="ComboBox">
<DataValidationErrors>
<Grid ColumnDefinitions="*, Auto, 32">
<Grid ColumnDefinitions="*, 32">
<Border
x:Name="Background"
Grid.Column="0"
Grid.ColumnSpan="3"
Grid.ColumnSpan="2"
Background="{TemplateBinding Background}"
BackgroundSizing="{TemplateBinding BackgroundSizing}"
BorderBrush="{TemplateBinding BorderBrush}"
@ -86,7 +86,7 @@
Theme="{DynamicResource InnerIconButton}" />
<Border
x:Name="DropDownOverlay"
Grid.Column="2"
Grid.Column="1"
Width="30"
Margin="0,1,1,1"
HorizontalAlignment="Right"
@ -95,7 +95,7 @@
<PathIcon
x:Name="DropDownGlyph"
Grid.Column="2"
Grid.Column="1"
Width="12"
Height="12"
Margin="0,0,10,0"
@ -148,6 +148,9 @@
<Style Selector="^:pointerover /template/ Button#ClearButton">
<Setter Property="IsVisible" Value="{Binding $parent[ComboBox].SelectionBoxItem, Converter={x:Static ObjectConverters.IsNotNull}}" />
</Style>
<Style Selector="^:pointerover /template/ PathIcon#DropDownGlyph">
<Setter Property="IsVisible" Value="{Binding $parent[ComboBox].SelectionBoxItem, Converter={x:Static ObjectConverters.IsNull}}"/>
</Style>
</Style>
<Style Selector="^.Large">