ContextMenu.IsOpen 屬性

定義

取得或設定值,指出 ContextMenu 是否可見。

public:
 property bool IsOpen { bool get(); void set(bool value); };
[System.ComponentModel.Bindable(true)]
[System.ComponentModel.Browsable(false)]
public bool IsOpen { get; set; }
[<System.ComponentModel.Bindable(true)>]
[<System.ComponentModel.Browsable(false)>]
member this.IsOpen : bool with get, set
Public Property IsOpen As Boolean

屬性值

如果 ContextMenu 為可見,則為 true,否則為 false。 預設為 false

屬性

範例

此範例示範如何檢查屬性是否 IsOpen 設定為 true

if (cm.IsOpen == true)
{
    cmButton.Content = "The ContextMenu opened and the IsOpen property is true.";
}
If cm.IsOpen = True Then
    cmButton.Content = "The ContextMenu opened and the IsOpen property is true."
End If

備註

當 設定為 trueIsOpen ,滑鼠擷取會設定為 ContextMenu 及其子樹狀結構。

相依性屬性資訊

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

適用於

另請參閱