Merge pull request #355 from irihitech/clearButton

Fix TreeComboBox ClearButton position
This commit is contained in:
Dong Bin
2024-08-21 20:13:04 +08:00
committed by GitHub

View File

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