FrameworkContentElement.ContextMenu 屬性

定義

取得或設定內容功能表項目,該項目應該在每當從這個項目內透過使用者介面 (UI)user interface (UI) 要求內容功能表時出現。Gets or sets the context menu element that should appear whenever the context menu is requested via 使用者介面 (UI)user interface (UI) from within this element.

public:
 property System::Windows::Controls::ContextMenu ^ ContextMenu { System::Windows::Controls::ContextMenu ^ get(); void set(System::Windows::Controls::ContextMenu ^ value); };
public System.Windows.Controls.ContextMenu ContextMenu { get; set; }
member this.ContextMenu : System.Windows.Controls.ContextMenu with get, set
Public Property ContextMenu As ContextMenu

屬性值

這個項目使用的內容功能表。The context menu that this element uses.

範例

下列範例會將 ContextMenu 放在 Paragraph上。The following example places a ContextMenu on a Paragraph.

<Paragraph>Lorem ipsum etc.
  <Paragraph.ContextMenu>
    <ContextMenu Name="cm">
      <MenuItem Header="Edit"/>
      <MenuItem Header="Print"/>
    </ContextMenu>
  </Paragraph.ContextMenu>
</Paragraph>

備註

相依性屬性資訊Dependency Property Information

識別碼欄位Identifier field ContextMenuProperty
設定為 true 的中繼資料屬性Metadata properties set to true NoneNone

適用於

另請參閱