fix: fix TreeComboBox ClearButton position.

This commit is contained in:
Zhang Dian
2024-08-19 22:40:56 +08:00
parent 0c17aec5c3
commit f16a4bc160

View File

@@ -23,11 +23,11 @@
<Setter Property="Cursor" Value="Hand" />
<Setter Property="Template">
<ControlTemplate TargetType="u:TreeComboBox">
<Grid MinWidth="{TemplateBinding MinHeight}" ColumnDefinitions="Auto, *, Auto, Auto, Auto">
<Grid MinWidth="{TemplateBinding MinHeight}" ColumnDefinitions="Auto, *, Auto, Auto">
<Border
Name="Background"
Grid.Column="0"
Grid.ColumnSpan="5"
Grid.ColumnSpan="4"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
@@ -66,15 +66,8 @@
</MultiBinding>
</ContentPresenter.ContentTemplate>
</ContentPresenter>
<Button
Name="PART_ClearButton"
Grid.Column="2"
Command="{Binding $parent[u:TreeComboBox].Clear}"
IsVisible="False"
Theme="{DynamicResource InnerIconButton}"
Content="{DynamicResource IconButtonClearData}" />
<ContentPresenter
Grid.Column="3"
Grid.Column="2"
Margin="0 0 8 0"
VerticalAlignment="Center"
VerticalContentAlignment="Center"
@@ -82,22 +75,28 @@
Foreground="{DynamicResource TextBoxInnerForeground}"
IsVisible="{TemplateBinding InnerRightContent,
Converter={x:Static ObjectConverters.IsNotNull}}" />
<Panel
Grid.Column="4"
Width="32"
Background="Transparent"
IsHitTestVisible="True">
<PathIcon
x:Name="DropDownGlyph"
Width="12"
Height="12"
Margin="0,0,10,0"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Data="{DynamicResource ComboBoxIcon}"
Foreground="{DynamicResource ComboBoxIconDefaultForeground}"
UseLayoutRounding="False" />
</Panel>
<Button
Name="PART_ClearButton"
Grid.Column="3"
Command="{Binding $parent[u:TreeComboBox].Clear}"
Margin="0,0,8,0"
IsVisible="False"
Theme="{DynamicResource InnerIconButton}"
Content="{DynamicResource IconButtonClearData}" />
<PathIcon
x:Name="DropDownGlyph"
Grid.Column="3"
Width="12"
Height="12"
Margin="0,0,12,0"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Data="{DynamicResource ComboBoxIcon}"
Foreground="{DynamicResource ComboBoxIconDefaultForeground}"
UseLayoutRounding="False"
IsHitTestVisible="True" />
<Popup
Name="{x:Static iri:PartNames.PART_Popup}"
Grid.Column="0"
@@ -147,6 +146,9 @@
<Style Selector="^:pointerover /template/ Button#PART_ClearButton">
<Setter Property="IsVisible" Value="{Binding $parent[u:TreeComboBox].SelectionBoxItem, Converter={x:Static ObjectConverters.IsNotNull}}"/>
</Style>
<Style Selector="^:pointerover /template/ PathIcon#DropDownGlyph">
<Setter Property="IsVisible" Value="{Binding $parent[u:TreeComboBox].SelectionBoxItem, Converter={x:Static ObjectConverters.IsNull}}"/>
</Style>
</Style>
<Style Selector="^.Large">