SelectionContainer Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Provides a unified interface for accessing a set of selected objects.
public ref class SelectionContainer : Microsoft::VisualStudio::Shell::Interop::ISelectionContainer
[Windows::Foundation::Metadata::WebHostHidden]
class SelectionContainer : Microsoft::VisualStudio::Shell::Interop::ISelectionContainer
public class SelectionContainer : Microsoft.VisualStudio.Shell.Interop.ISelectionContainer
type SelectionContainer = class
interface ISelectionContainer
Public Class SelectionContainer
Implements ISelectionContainer
- Inheritance
-
SelectionContainer
- Implements
Remarks
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 SelectionContainer, 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 Inheritors
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.
Constructors
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. |
Fields
ALL |
Refers to all SelectableObjects. |
SELECTED |
Refers to all SelectedObjects. |
Properties
SelectableObjects |
Gets the collection of selectable objects. |
SelectedObjects |
Gets or sets the collection of selected objects. |
Methods
ActivateObjects() |
Overriding this method enables an object to respond when selected. |
Events
SelectedObjectsChanged |
Raised when an external object calls the ISelectionContainer.SelectObjects(UInt32, Object[], UInt32) method with the SELECTED flag set. |
Explicit Interface Implementations
ISelectionContainer.CountObjects(UInt32, UInt32) |
Determines the number of objects either those SELECTED or ALL items. |
ISelectionContainer.GetObjects(UInt32, UInt32, Object[]) |
Sets |
ISelectionContainer.SelectObjects(UInt32, Object[], UInt32) |
Sets the collection of selectable objects. |