SelectionContainer Class
Provides a unified interface for accessing a set of selected objects.
This API is not CLS-compliant.
Namespace: Microsoft.VisualStudio.Shell
Assemblies: Microsoft.VisualStudio.Shell.10.0 (in Microsoft.VisualStudio.Shell.10.0.dll)
Microsoft.VisualStudio.Shell (in Microsoft.VisualStudio.Shell.dll)
Microsoft.VisualStudio.Shell.9.0 (in Microsoft.VisualStudio.Shell.9.0.dll)
Syntax
声明
<CLSCompliantAttribute(False)> _
Public Class SelectionContainer _
Implements ISelectionContainer
用法
Dim instance As SelectionContainer
[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
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 by an external object calling SelectObjects(UInt32, array<Object[], UInt32), 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 methods.
When changes occur that affect the Properties window, the VSPackage must alert the environment by calling the OnSelectChange method with the SelectionContainer object that reflects the current selection context. The environment then makes calls to the SelectionContainer methods to retrieve one or more IDispatch objects, which provide access to the data needed to update the Properties window.
The SelectionContainer 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.
Inheritance Hierarchy
System.Object
Microsoft.VisualStudio.Shell.SelectionContainer
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.VisualStudio.Shell Namespace