SeparatorStyleKey Property

MenuItem::SeparatorStyleKey Property

 

Gets the resource key for a style applied to a MenuItem when the MenuItem is a Separator.

Namespace:   System.Windows.Controls
Assembly:  PresentationFramework (in PresentationFramework.dll)

public:
property ResourceKey^ SeparatorStyleKey {
	static ResourceKey^ get();
}

Property Value

Type: System.Windows::ResourceKey^

The resource key for a style applied to a MenuItem when the MenuItem is a Separator.

Use this property to change the style of a Separator in a menu.

<object property={ MenuItem.SeparatorStyleKey}"/>

The following example shows how to use this property to style a Separator in a Menu.

<Style x:Key="{x:Static MenuItem.SeparatorStyleKey}" TargetType="Separator">
  <Setter Property="OverridesDefaultStyle" Value="true" />
  <Setter Property="Template">
    <Setter.Value>
      <ControlTemplate TargetType="{x:Type Separator}">
        <Border Width="30" Height="4" Margin="4" Background="Red"/>
      </ControlTemplate>
    </Setter.Value>
  </Setter>
</Style>

.NET Framework
Available since 3.0

MenuItem Class
System.Windows.Controls Namespace
Style a Separator Used as a Menu Item

Return to top
Show:
© 2016 Microsoft