Browse Source

Make Separator look correct.

Previously there was a `MenuItem > Separator` selector, but I don't really see any reason to just apply this style directly to `Separator` itself. It's mainly used in menus and if one wants to use it elsewhere then they'd need to set these properties anyway.
pull/8479/head
Steven Kirk 4 years ago
parent
commit
a9925f928c
  1. 5
      src/Avalonia.Themes.Fluent/Controls/MenuItem.xaml
  2. 4
      src/Avalonia.Themes.Fluent/Controls/Separator.xaml

5
src/Avalonia.Themes.Fluent/Controls/MenuItem.xaml

@ -26,6 +26,7 @@
<MenuItem Header="Child 1"/> <MenuItem Header="Child 1"/>
<MenuItem Header="Child 2"/> <MenuItem Header="Child 2"/>
<MenuItem Header="Child 3"/> <MenuItem Header="Child 3"/>
<Separator/>
<MenuItem Header="Child 4"/> <MenuItem Header="Child 4"/>
<MenuItem Header="Child 5"/> <MenuItem Header="Child 5"/>
<MenuItem Header="Child 6"/> <MenuItem Header="Child 6"/>
@ -204,9 +205,7 @@
<Style Selector="^:separator"> <Style Selector="^:separator">
<Setter Property="Template"> <Setter Property="Template">
<ControlTemplate> <ControlTemplate>
<Separator Background="{DynamicResource SystemControlForegroundBaseMediumLowBrush}" <Separator/>
Margin="{DynamicResource MenuFlyoutSeparatorThemePadding}"
Height="{DynamicResource MenuFlyoutSeparatorThemeHeight}"/>
</ControlTemplate> </ControlTemplate>
</Setter> </Setter>
</Style> </Style>

4
src/Avalonia.Themes.Fluent/Controls/Separator.xaml

@ -1,7 +1,11 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui" <ResourceDictionary xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ControlTheme x:Key="{x:Type Separator}" TargetType="Separator"> <ControlTheme x:Key="{x:Type Separator}" TargetType="Separator">
<Setter Property="Background" Value="{DynamicResource SystemControlForegroundBaseMediumLowBrush}" />
<Setter Property="Focusable" Value="False" /> <Setter Property="Focusable" Value="False" />
<Setter Property="Height" Value="{DynamicResource MenuFlyoutSeparatorThemeHeight}" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="Margin" Value="{DynamicResource MenuFlyoutSeparatorThemePadding}" />
<Setter Property="Template"> <Setter Property="Template">
<ControlTemplate> <ControlTemplate>
<Border Padding="{TemplateBinding Margin}" <Border Padding="{TemplateBinding Margin}"

Loading…
Cancel
Save