通过


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

属性值

true 如果可见,则 ContextMenu 为 .;否则为 false。 默认值为 false

属性

示例

此示例演示如何检查以确定属性是否 IsOpen 设置为 true

if (cm.IsOpen)
{
    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

注解

true设置为时IsOpen,鼠标捕获将设置为ContextMenu及其子树。

Dependency 属性信息

物品 价值
标识符字段 IsOpenProperty
元数据属性设置为 true BindsTwoWayByDefault

适用于

另请参阅