Share via


MenuFlyoutSeparator styles and templates

[ This article is for Windows 8.x and Windows Phone 8.x developers writing Windows Runtime apps. If you’re developing for Windows 10, see the latest documentation ]

This topic describes the styles and templates for the MenuFlyoutSeparator control. You can modify these resources and the default ControlTemplate to give the control a unique appearance.

Visual states

These are the VisualStates defined in the control's default style.

VisualState name VisualStateGroup name Description
Normal CommonStates The default state.
PointerOver CommonStates The pointer is positioned over the control.
Pressed CommonStates The control is pressed.
Disabled CommonStates The control is disabled.
NoPlaceholder CheckPlaceholderStates The control doesn't reserve space for a check mark.
CheckPlaceholder CheckPlaceholderStates The control reserves space for a check mark.
Focused FocusStates The control has focus.
Unfocused FocusStates The control doesn't have focus.
PointerFocused FocusStates The control has focus obtained through a pointer action.

 

For more info about focus states, see Control.FocusState.

Theme resources

These resources are used in the control's default style.

Dark theme brushes

To change the colors of the control in the dark theme, override these brushes in App.xaml.

<SolidColorBrush x:Key="MenuFlyoutSeparatorThemeBrush" Color="#FF7A7A7A" />

Light theme brushes

To change the colors of the control in the light theme, override these brushes in App.xaml.

<SolidColorBrush x:Key="MenuFlyoutSeparatorThemeBrush" Color="#FF7A7A7A" />

Other resources

<x:Double x:Key="MenuFlyoutSeparatorThemeHeight">1</x:Double>
<Thickness x:Key="MenuFlyoutSeparatorThemePadding">20,9,20,10</Thickness>

For more info on theme resources, including the values that are used for the HighContrast theme, see XAML theme resources reference.

Default style

<!-- Default style for Windows.UI.Xaml.Controls.MenuFlyoutSeparator -->
<Style TargetType="MenuFlyoutSeparator">
    <Setter Property="Background" Value="{ThemeResource MenuFlyoutSeparatorThemeBrush}" />
    <Setter Property="Padding" Value="{ThemeResource MenuFlyoutSeparatorThemePadding}" />
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="MenuFlyoutSeparator">
                <Rectangle Fill="{TemplateBinding Background}"
                           Margin="{TemplateBinding Padding}"
                           Height="{ThemeResource MenuFlyoutSeparatorThemeHeight}" />
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>