MenuItem.SeparatorStyleKey 属性

定义

获取当 MenuItemMenuItem 时应用于 Separator 的样式的资源键。Gets the resource key for a style applied to a MenuItem when the MenuItem is a Separator.

public:
 static property System::Windows::ResourceKey ^ SeparatorStyleKey { System::Windows::ResourceKey ^ get(); };
public static System.Windows.ResourceKey SeparatorStyleKey { get; }
member this.SeparatorStyleKey : System.Windows.ResourceKey
Public Shared ReadOnly Property SeparatorStyleKey As ResourceKey

属性值

MenuItemMenuItem 时应用于 Separator 的样式的资源键。The resource key for a style applied to a MenuItem when the MenuItem is a Separator.

示例

下面的示例演示如何使用此属性来对Separator Menu中的进行样式。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>

注解

使用此属性可在菜单中更改的Separator样式。Use this property to change the style of a Separator in a menu.

XAML 属性用法XAML Attribute Usage

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

适用于

另请参阅