Provides a unified interface for accessing a set of selected objects.
This API is not CLS-compliant.
Assembly: Microsoft.VisualStudio.Shell.10.0 (in Microsoft.VisualStudio.Shell.10.0.dll)
'Declaration <CLSCompliantAttribute(False)> _ Public Class SelectionContainer _ Implements ISelectionContainer
[CLSCompliantAttribute(false)] public class SelectionContainer : ISelectionContainer
[CLSCompliantAttribute(false)] public ref class SelectionContainer : ISelectionContainer
[<CLSCompliantAttribute(false)>] type SelectionContainer = class interface ISelectionContainer end
public class SelectionContainer implements ISelectionContainer
The SelectionContainer type exposes the following members.
|SelectionContainer()||Initializes a new SelectionContainer object. The overload provides the ability to restrict user control over the SelectableObjects and SelectedObjects collections.|
|SelectionContainer(Boolean, Boolean)||Creates a new SelectionContainer object with the ability to restrict user control over the SelectableObjects and SelectedObjects collections.|
|SelectableObjects||Gets the collection of selectable objects.|
|SelectedObjects||Gets or sets the collection of selected objects.|
|ActivateObjects||Overriding this method enables an object to respond when selected.|
|Equals||Determines whether the specified Object is equal to the current Object. (Inherited from Object.)|
|Finalize||Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)|
|GetHashCode||Serves as a hash function for a particular type. (Inherited from Object.)|
|GetType||Gets the Type of the current instance. (Inherited from Object.)|
|MemberwiseClone||Creates a shallow copy of the current Object. (Inherited from Object.)|
|ToString||Returns a string that represents the current object. (Inherited from Object.)|
|SelectedObjectsChanged||Raised when an external object calls the ISelectionContainer.SelectObjects method with the SELECTED flag set.|
|ALL||Refers to all SelectableObjects.|
|SELECTED||Refers to all SelectedObjects.|
Explicit Interface Implementations
|ISelectionContainer.CountObjects||Determines the number of objects either those SELECTED or ALL items.|
|ISelectionContainer.GetObjects||Sets cObjects with the number of items SELECTED or ALL items and populates array apUnkObjects with pointers to those objects.|
|ISelectionContainer.SelectObjects||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.