Share via


SelectionOperations.Toggle Method

Processes a request to programmatically toggle the selection state of an object in the designer.

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

Syntax

'Declaration
Public Shared Function Toggle ( _
    context As EditingContext, _
    itemToToggle As ModelItem _
) As Selection
public static Selection Toggle(
    EditingContext context,
    ModelItem itemToToggle
)
public:
static Selection^ Toggle(
    EditingContext^ context, 
    ModelItem^ itemToToggle
)
static member Toggle : 
        context:EditingContext * 
        itemToToggle:ModelItem -> Selection 
public static function Toggle(
    context : EditingContext, 
    itemToToggle : ModelItem
) : Selection

Parameters

Return Value

Type: Microsoft.Windows.Design.Interaction.Selection
A new selection that contains or does not contain the object to toggle. See the remarks section for more information.

Exceptions

Exception Condition
ArgumentNullException

context or itemToToggle is nulla null reference (Nothing in Visual Basic).

Remarks

If the specified object is already selected, it is deselected. If it is the only selected item, this method attempts to select the parent of the object.

If the specified object is not selected, it becomes selected and it becomes the primary selection object.

This command does not change the selected state of any other objects in the designer.

.NET Framework Security

See Also

Reference

SelectionOperations Class

Microsoft.Windows.Design.Interaction Namespace

Selection

SelectionCommands

ToggleSelectTarget

SelectionTool

EditingContext

Other Resources

WPF Designer Extensibility Architecture