feat: support HorizontalAlignment="Stretch".

This commit is contained in:
Zhang Dian
2025-03-12 13:59:32 +08:00
parent 08552cf57e
commit 7e33078f00
2 changed files with 9 additions and 4 deletions

View File

@@ -49,7 +49,7 @@
<TextBlock Text="Use Style to customize button" /> <TextBlock Text="Use Style to customize button" />
<ColorPicker <ColorPicker
Margin="8" Margin="8"
Width="32" MinWidth="32"
HsvColor="hsv(180,80%,70%)"> HsvColor="hsv(180,80%,70%)">
<ColorPicker.Content> <ColorPicker.Content>
<Border <Border

View File

@@ -7,7 +7,8 @@
<converters:ToBrushConverter x:Key="ToBrushConverter" /> <converters:ToBrushConverter x:Key="ToBrushConverter" />
<ControlTheme x:Key="{x:Type ColorPicker}" TargetType="ColorPicker"> <ControlTheme x:Key="{x:Type ColorPicker}" TargetType="ColorPicker">
<Setter Property="Width" Value="64" /> <Setter Property="MinWidth" Value="64" />
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="MinHeight" Value="{DynamicResource ColorPickerMinHeight}" /> <Setter Property="MinHeight" Value="{DynamicResource ColorPickerMinHeight}" />
<Setter Property="CornerRadius" Value="{DynamicResource ColorPickerCornerRadius}" /> <Setter Property="CornerRadius" Value="{DynamicResource ColorPickerCornerRadius}" />
<Setter Property="Content"> <Setter Property="Content">
@@ -34,6 +35,8 @@
Height="{TemplateBinding Height}" Height="{TemplateBinding Height}"
MinWidth="{TemplateBinding MinWidth}" MinWidth="{TemplateBinding MinWidth}"
MinHeight="{TemplateBinding MinHeight}" MinHeight="{TemplateBinding MinHeight}"
HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
VerticalAlignment="{TemplateBinding VerticalAlignment}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
Content="{TemplateBinding Content}" Content="{TemplateBinding Content}"
@@ -450,7 +453,7 @@
x:Key="HexColorPicker" x:Key="HexColorPicker"
BasedOn="{StaticResource {x:Type ColorPicker}}" BasedOn="{StaticResource {x:Type ColorPicker}}"
TargetType="ColorPicker"> TargetType="ColorPicker">
<Setter Property="Width" Value="200" /> <Setter Property="MinWidth" Value="200" />
<Setter Property="Content"> <Setter Property="Content">
<Template> <Template>
<Grid ColumnDefinitions="Auto, *"> <Grid ColumnDefinitions="Auto, *">
@@ -495,6 +498,8 @@
Height="{TemplateBinding Height}" Height="{TemplateBinding Height}"
MinWidth="{TemplateBinding MinWidth}" MinWidth="{TemplateBinding MinWidth}"
MinHeight="{TemplateBinding MinHeight}" MinHeight="{TemplateBinding MinHeight}"
HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
VerticalAlignment="{TemplateBinding VerticalAlignment}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
Content="{TemplateBinding Content}" Content="{TemplateBinding Content}"
@@ -643,7 +648,7 @@
x:Key="HexSimpleColorPicker" x:Key="HexSimpleColorPicker"
BasedOn="{StaticResource SimpleColorPicker}" BasedOn="{StaticResource SimpleColorPicker}"
TargetType="ColorPicker"> TargetType="ColorPicker">
<Setter Property="Width" Value="200" /> <Setter Property="MinWidth" Value="200" />
<Setter Property="Content"> <Setter Property="Content">
<Template> <Template>
<Grid ColumnDefinitions="Auto, *"> <Grid ColumnDefinitions="Auto, *">