Udostępnij za pośrednictwem


MenuActionEventArgs.Selection Property

Gets the current selection on the design surface.

Namespace:  Microsoft.Windows.Design.Interaction
Assembly:  Microsoft.Windows.Design.Extensibility (in Microsoft.Windows.Design.Extensibility.dll)

Syntax

'Declaration
Public ReadOnly Property Selection As Selection
'Usage
Dim instance As MenuActionEventArgs 
Dim value As Selection 

value = instance.Selection
public Selection Selection { get; }
public:
property Selection^ Selection {
    Selection^ get ();
}
public function get Selection () : Selection

Property Value

Type: Microsoft.Windows.Design.Interaction.Selection
A Selection representing the currently selected control.

Examples

The following code example shows how to handle the Execute event. It sets the selected control's Background property to its default value. For more information, see Walkthrough: Creating a MenuAction.

' 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(Control.BackgroundProperty).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[Control.BackgroundProperty].ClearValue();
}

.NET Framework Security

See Also

Reference

MenuActionEventArgs Class

MenuActionEventArgs Members

Microsoft.Windows.Design.Interaction Namespace

PrimarySelectionContextMenuProvider

MenuAction

MenuGroup

ModelItem

Other Resources

Walkthrough: Creating a MenuAction