SelectionContainer Class

 

Provides a unified interface for accessing a set of selected objects.

Namespace:   Microsoft.VisualStudio.Shell
Assembly:  Microsoft.VisualStudio.Shell.14.0 (in Microsoft.VisualStudio.Shell.14.0.dll)

System.Object
  Microsoft.VisualStudio.Shell.SelectionContainer

public class SelectionContainer : ISelectionContainer

NameDescription
System_CAPS_pubmethodSelectionContainer()

Initializes a new SelectionContainer object. The overload provides the ability to restrict user control over the SelectableObjects and SelectedObjects collections.

System_CAPS_pubmethodSelectionContainer(Boolean, Boolean)

Creates a new SelectionContainer object with the ability to restrict user control over the SelectableObjects and SelectedObjects collections.

NameDescription
System_CAPS_pubpropertySelectableObjects

Gets the collection of selectable objects.

System_CAPS_pubpropertySelectedObjects

Gets or sets the collection of selected objects.

NameDescription
System_CAPS_protmethodActivateObjects()

Overriding this method enables an object to respond when selected.

System_CAPS_pubmethodEquals(Object)

(Inherited from Object.)

System_CAPS_protmethodFinalize()

(Inherited from Object.)

System_CAPS_pubmethodGetHashCode()

(Inherited from Object.)

System_CAPS_pubmethodGetType()

(Inherited from Object.)

System_CAPS_protmethodMemberwiseClone()

(Inherited from Object.)

System_CAPS_pubmethodToString()

(Inherited from Object.)

NameDescription
System_CAPS_pubfieldSystem_CAPS_staticALL

Refers to all SelectableObjects.

System_CAPS_pubfieldSystem_CAPS_staticSELECTED

Refers to all SelectedObjects.

NameDescription
System_CAPS_pubeventSelectedObjectsChanged

Raised when an external object calls the ISelectionContainer.SelectObjects method with the SELECTED flag set.

NameDescription
System_CAPS_pubinterfaceSystem_CAPS_privmethodISelectionContainer.CountObjects(UInt32, UInt32)

Determines the number of objects either those SELECTED or ALL items.

System_CAPS_pubinterfaceSystem_CAPS_privmethodISelectionContainer.GetObjects(UInt32, UInt32, Object[])

Sets cObjects with the number of items SELECTED or ALL items and populates array apUnkObjects with pointers to those objects.

System_CAPS_pubinterfaceSystem_CAPS_privmethodISelectionContainer.SelectObjects(UInt32, Object[], UInt32)

Sets the collection of selectable objects.

The SelectionContainer class provides a unified interface for accessing a set of selected objects. It implements all of the methods defined by the ISelectionContainer interface, and adds a new method, ActivateObjects, that enables an object to respond when selected.

Typically, the contents of the selection container are modified when an external object calls SelectObjects, which triggers a SelectedObjectsChanged event (and can also call the ActivateObjects method, if it is implemented.) The contents of the selection container can also be examined or changed by accessing the SelectedObjects or SelectableObjects properties.

When changes occur that affect the Properties window, the VSPackage must alert the environment by calling the OnSelectChange method with the selection container that reflects the current selection context. The shell then makes calls to SelectionContainer methods to retrieve one or more IDispatch objects, which provide access to the data needed to update the Properties window.

This class also simplifies some interoperability issues with the ISelectionContainer interfaces. Different versions of Visual Studio implement different versions of ISelectionContainer, and SelectionContainer provides seamless interoperability with the different implementations.

Notes to Implementers:

A selection container is the mechanism used by windows to push information to the Properties window. A VSPackage should include a SelectionContainer object for each object (typically a window) that contains selectable objects with related properties to be displayed in the Properties window.

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

Return to top
Show: