fix: fix EnumSelector default Width & Alignment.

This commit is contained in:
Zhang Dian
2024-06-24 16:30:29 +08:00
parent 68c799b032
commit aabc2c9577
2 changed files with 9 additions and 4 deletions

View File

@@ -18,12 +18,16 @@
<Setter Property="Width" Value="{Binding ItemSelfWidth}" />
<Setter Property="Height" Value="{Binding ItemSelfHeight}" />
</Style>
<Style Selector="u|EnumSelector">
<Setter Property="HorizontalAlignment" Value="Stretch" />
</Style>
</UserControl.Styles>
<DockPanel>
<u:Form DockPanel.Dock="Left"
LabelAlignment="Left"
LabelPosition="Left"
LabelWidth="*">
LabelWidth="*"
Margin="4 0">
<u:FormGroup>
<u:FormItem Label="Orientation">
<u:EnumSelector EnumType="Orientation" Value="{Binding SelectedOrientation}" />

View File

@@ -4,12 +4,13 @@
xmlns:u="https://irihi.tech/ursa">
<!-- Add Resources Here -->
<ControlTheme x:Key="{x:Type u:EnumSelector}" TargetType="u:EnumSelector">
<Setter Property="Width" Value="100" />
<Setter Property="HorizontalAlignment" Value="Left"></Setter>
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="Template">
<ControlTemplate TargetType="u:EnumSelector">
<ComboBox
Width="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Bounds.Width}"
Width="{TemplateBinding Width}"
HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
VerticalAlignment="{TemplateBinding VerticalAlignment}"
Name="PART_ComboBox"
ItemsSource="{TemplateBinding Values}"
SelectedItem="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=SelectedValue, Mode=TwoWay}" />