This documentation is archived and is not being maintained.

IVsTrackSelectionEx.OnElementValueChange Method

Informs the environment that a change in an element value has occurred. Element values are attached to a window's selection context and used in the same way to update the environment's user interface.

Namespace: Microsoft.VisualStudio.Shell.Interop
Assembly: Microsoft.VisualStudio.Shell.Interop (in

int OnElementValueChange (
	[InAttribute] uint elementid,
	[InAttribute] int fDontPropagate,
	[InAttribute] Object varValue
int OnElementValueChange (
	/** @attribute InAttribute() */ UInt32 elementid, 
	/** @attribute InAttribute() */ int fDontPropagate, 
	/** @attribute InAttribute() */ Object varValue
function OnElementValueChange (
	elementid : uint, 
	fDontPropagate : int, 
	varValue : Object
) : int



[in] Identifier of the element that has changed. For a list of valid elementid values, see VSSELELEMID.


[in] Flag that indicates whether or not selected values should be broadcast throughout the environment. If set to true, the information stored in varValue relating to the element is kept private. If set to false, the varValue information is made available to the environment.


[in] Private data related to the element identified by elementid.

Return Value

If the method succeeds, it returns S_OK. If it fails, it returns an error code.

COM Signature

From vsshell.idl:

HRESULT IVsTrackSelectionEx::OnElementValueChange(
   [in] VSSELELEMID elementid,
   [in] BOOL fDontPropagate,
   [in] VARIANT varValue

An editor or tool calls OnElementValueChange when its containing frame becomes active.

The fDontPropagate parameter controls whether information pertaining to the element is published at the global level or kept private. By default, all elements of selection set fDontPropagate to true when a window is first created. Elements of selection that are managed at the global level by the environment or another VSPackage should remain with "DontPropagate" at the document/tool window level. For example, the SolutionBuildManager manages the SEID_StartupProject element and sets fDontPropagate for all of the windows owned by the project to true.

Elements of selection that are managed by the context of the document should set to fDontPropagate==false. For example, a document might want to publicize its UndoManager element (SEID_UndoManager) so that other windows such as the Properties window can add undo actions to the document's undo stack. Clients that have registered for selection events are notified only when fDontPropagate is set to false.