Share via


Selection Class

Represents a set of objects selected by a user in a designer.

Inheritance Hierarchy

System.Object
  Microsoft.Windows.Design.ContextItem
    Microsoft.Windows.Design.Interaction.Selection

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

Syntax

'Declaration
Public Class Selection _
    Inherits ContextItem
public class Selection : ContextItem
public ref class Selection : public ContextItem
type Selection =  
    class
        inherit ContextItem
    end
public class Selection extends ContextItem

The Selection type exposes the following members.

Constructors

  Name Description
Public method Selection() Initializes a new instance of the Selection class.
Public method Selection(IEnumerable) Initializes a new instance of the Selection class with the specified enumeration of objects.
Public method Selection(array<ModelItem[]) Initializes a new instance of the Selection class with the specified array of ModelItem objects.
Public method Selection(IEnumerable<ModelItem>) Initializes a new instance of the Selection class with the specified enumeration of ModelItem objects.
Public method Selection(IEnumerable, Predicate<ModelItem>) Initializes a new instance of the Selection class with the specified enumeration of objects and predicate.
Public method Selection(IEnumerable<ModelItem>, Predicate<ModelItem>) Initializes a new instance of the Selection class by using the specified enumeration of ModelItem objects and predicate.

Top

Properties

  Name Description
Public property ItemType Gets the type of Selection. (Overrides ContextItem.ItemType.)
Public property PrimarySelection Gets the primary selection object.
Public property SelectedObjects Gets an enumeration of the objects in the selection.
Public property SelectionCount Gets the number of objects in the selection.
Public property ViewSelection Gets a selection that contains model items that provide a view.

Top

Methods

  Name Description
Public method Equals Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected method Finalize Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public method GetHashCode Serves as a hash function for a particular type. (Inherited from Object.)
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Protected method MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Protected method OnItemChanged Called on a context item before it is stored in the context item manager. (Inherited from ContextItem.)
Public method ToString Returns a string that represents the current object. (Inherited from Object.)

Top

Remarks

The concept of selection is different for different types of designers. When a user selects objects in a designer, there are some standard behaviors the designer should exhibit. For example, the user should be able to select an object, select multiple objects, cancel the selection of objects, and select all objects. You can use extensibility to control how the user selects objects in the designer.

Note

Other types of selection that are not covered here include text selection, where a range of text on an object is selected, and point selection, where one or more points on a curve are selected. Complex selection patterns, such as dragging a rectangle to select several objects, are handled by the TaskProvider providers of those objects.

When multiple objects are selected in a designer, one object is the primary selection object. The primary selection object is often used as a key for other behaviors. For example, to align all selected objects to the left, the primary selection object determines where to align the objects.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

Microsoft.Windows.Design.Interaction Namespace

SelectionCommands

SelectionOperations

SelectionTool

EditingContext

Other Resources

WPF Designer Extensibility Architecture