Share via


ModelItem Class

Represents a single item in the editing model.

Inheritance Hierarchy

System.Object
  Microsoft.Windows.Design.Model.ModelItem
    Microsoft.Windows.Design.Model.ModelItemCollection
    Microsoft.Windows.Design.Model.ModelItemDictionary

Namespace:  Microsoft.Windows.Design.Model
Assembly:  Microsoft.Windows.Design.Interaction (in Microsoft.Windows.Design.Interaction.dll)

Syntax

'Declaration
Public MustInherit Class ModelItem _
    Implements INotifyPropertyChanged
public abstract class ModelItem : INotifyPropertyChanged
public ref class ModelItem abstract : INotifyPropertyChanged
[<AbstractClass>]
type ModelItem =  
    class
        interface INotifyPropertyChanged
    end
public abstract class ModelItem implements INotifyPropertyChanged

The ModelItem type exposes the following members.

Constructors

  Name Description
Protected method ModelItem Initializes a new instance of the ModelItem class.

Top

Properties

  Name Description
Public property Content When overridden in a derived class, gets a ModelProperty representing the item's ContentPropertyAttribute.
Public property Context Gets an object that contains contextual information about the designer this ModelItem was created for.
Public property Events When overridden in a derived class, gets the public events on this object.
Public property ItemType When overridden in a derived class, gets the type of object the item represents.
Public property Name When overridden in a derived class, gets or sets the name or ID of the item.
Public property Parent When overridden in a derived class, gets the item that is the parent of this item.
Public property Properties When overridden in a derived class, gets the public properties on this object.
Public property Root When overridden in a derived class, gets the item that is the root of this tree.
Public property Source When overridden in a derived class, gets the property that provided this value.
Public property View When overridden in a derived class, gets the visual or visual3D representing the UI for this item.

Top

Methods

  Name Description
Public method BeginEdit() When overridden in a derived class, this method is called when performing multiple operations on an object or group of objects.
Public method BeginEdit(String) When overridden in a derived class, this method is called when performing multiple operations on an object or group of objects.
Public method Equals Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected method Finalize Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public method GetAttributes(Type) Gets the attributes of the requested type that are declared on this item.
Public method GetAttributes(TypeIdentifier) Gets the attributes of the requested type that are declared on this item.
Public method GetCurrentValue When overridden in a derived class, returns the current value of the underlying model object the ModelItem is wrapping.
Public method GetHashCode Serves as a hash function for a particular type. (Inherited from Object.)
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Public method IsItemOfType(Type) Gets a value that indicates whether this item is of the specified type or implements the specified interface.
Public method IsItemOfType(TypeIdentifier) Gets a value that indicates whether this item is of the specified type or implements the specified interface.
Protected method MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Public method ToString Returns a string that represents the current object. (Inherited from Object.)

Top

Events

  Name Description
Public event PropertyChanged When overridden in a derived class, occurs when a property on the model changes.

Top

Remarks

The ModelItem class represents a single item in the editing model. An item can be anything from a window or a control down to a color or an integer. You may access the item’s properties through its Properties collection and make changes to the values of the properties. A ModelItem is essentially a wrapper around the designer’s underlying data model. You can access the underlying model through the GetCurrentValue method.

Always use the CreateItem method to create new objects on the design surface. This is because many raw instances cannot be parsed into model items. Once a value is set in the model, you should only interact with it through the model. The instance backing the model can be rebuilt by the framework at any time, which invalidates any references you have cached.

Note

You should never make any serializable changes to an object returned from the GetCurrentValue method. The changes will not be reflected back in the designer’s serialization or undo systems.

Note

Use the invariant culture when setting model item values by using strings.

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.Model Namespace

Other Resources

WPF Designer Extensibility Architecture

Editing Model Architecture