MenuFlyoutSeparator styles and templates

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 nameVisualStateGroup nameDescription
NormalCommonStatesThe default state.
PointerOverCommonStatesThe pointer is positioned over the control.
PressedCommonStatesThe control is pressed.
DisabledCommonStatesThe control is disabled.
NoPlaceholderCheckPlaceholderStatesThe control doesn't reserve space for a check mark.
CheckPlaceholderCheckPlaceholderStatesThe control reserves space for a check mark.
FocusedFocusStatesThe control has focus.
UnfocusedFocusStatesThe control doesn't have focus.
PointerFocusedFocusStatesThe 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>

 

 

Show:
© 2017 Microsoft