ContextItem Class
Represents a single piece of state in the designer.
Inheritance Hierarchy
System.Object
Microsoft.Windows.Design.ContextItem
Microsoft.Windows.Design.AssemblyReferences
Microsoft.Windows.Design.Interaction.CurrentDesignerView
Microsoft.Windows.Design.Interaction.FocusedTask
Microsoft.Windows.Design.Interaction.Selection
Microsoft.Windows.Design.Interaction.Tool
Namespace: Microsoft.Windows.Design
Assembly: Microsoft.Windows.Design.Extensibility (in Microsoft.Windows.Design.Extensibility.dll)
Syntax
'Declaration
Public MustInherit Class ContextItem
public abstract class ContextItem
public ref class ContextItem abstract
[<AbstractClass>]
type ContextItem = class end
public abstract class ContextItem
The ContextItem type exposes the following members.
Constructors
Name | Description | |
---|---|---|
ContextItem | Initializes a new instance of the ContextItem class. |
Top
Properties
Name | Description | |
---|---|---|
ItemType | When overridden in a derived class, gets the item type for this editing context item. |
Top
Methods
Name | Description | |
---|---|---|
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.) | |
OnItemChanged | Called on a context item before it is stored in the context item manager. | |
ToString | Returns a string that represents the current object. (Inherited from Object.) |
Top
Remarks
Context items are immutable objects that contain state. Some context items also define methods that can perform operations on the state they contain. ContextItem is the base class from which all context items must derive.
A context item may come and go in an editing context. Context items are transient, but they always have a value. Even if a particular context item is not in the context, a default value is always provided. Therefore, the context never returns nulla null reference (Nothing in Visual Basic).
Unlike a service, the value of a context item can change at any moment. This means that you should not cache context items. Code that uses the context can subscribe to a SubscribeContextCallback<TContextItemType> that is raised when a particular type of context item changes.
A class derived from ContextItem must define an empty constructor. This empty constructor version of a context item represents its default value. This default value is the value returned from GetValue if the ContextItemManager does not contain a context item of the requested type.
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.Windows.Design Namespace
SubscribeContextCallback<TContextItemType>