MenuActionEventArgs.Selection 属性

获取设计图面上的当前选择。

命名空间:  Microsoft.Windows.Design.Interaction
程序集:  Microsoft.Windows.Design.Interaction(在 Microsoft.Windows.Design.Interaction.dll 中)

语法

声明
Public ReadOnly Property Selection As Selection
    Get
public Selection Selection { get; }
public:
property Selection^ Selection {
    Selection^ get ();
}
member Selection : Selection
function get Selection () : Selection

属性值

类型:Microsoft.Windows.Design.Interaction.Selection
一个表示当前选定控件的 Selection

示例

下面的代码示例演示如何处理 Execute 事件。 该示例将所选的控件的 Background 属性设置为它的默认值。 有关更多信息,请参见 演练:创建菜单提供程序

' The following method handles the Execute event. 
' It sets the Background property to its default value.
Sub ClearBackground_Execute( _
    ByVal sender As Object, _
    ByVal e As MenuActionEventArgs)

    Dim selectedControl As ModelItem = e.Selection.PrimarySelection
    selectedControl.Properties("Background").ClearValue()

End Sub
// The following method handles the Execute event. 
// It sets the Background property to its default value.
void ClearBackground_Execute(
    object sender, 
    MenuActionEventArgs e)
{
    ModelItem selectedControl = e.Selection.PrimarySelection;
    selectedControl.Properties["Background"].ClearValue();
}

.NET Framework 安全性

请参见

参考

MenuActionEventArgs 类

Microsoft.Windows.Design.Interaction 命名空间

PrimarySelectionContextMenuProvider

MenuAction

MenuGroup

ModelItem

其他资源

演练:创建菜单提供程序