ContextMenuService.IsEnabled 附加屬性

定義

取得或設定值,這個值表示 ContextMenu 是否可以顯示。

see GetIsEnabled, and SetIsEnabled
see GetIsEnabled, and SetIsEnabled
see GetIsEnabled, and SetIsEnabled

範例

下列範例示範如何藉由將 屬性設定 IsEnabled 為 false 來停用操作功能表。

<Button ContextMenuService.IsEnabled="false">
  Button with a disabled context menu
  <Button.ContextMenu>
    <ContextMenu>
      <MenuItem Header="Item"/>
    </ContextMenu>
  </Button.ContextMenu>
</Button>

備註

IsEnabled當使用者以滑鼠右鍵按一下父控制項時,屬性是 false 操作功能表不會出現時。

相依性屬性資訊

識別碼欄位 IsEnabledProperty
設定為 的中繼資料屬性 true

適用於

另請參閱