This topic has not yet been rated - Rate this topic

ModelFactory Class

Used to create instances of model items in the designer.

System.Object
  Microsoft.Windows.Design.Model.ModelFactory

Namespace:  Microsoft.Windows.Design.Model
Assembly:  Microsoft.Windows.Design.Interaction (in Microsoft.Windows.Design.Interaction.dll)
public static class ModelFactory

The ModelFactory type exposes the following members.

  Name Description
Public method Static member CreateItem(EditingContext, Object) Creates a new model item by creating a deep copy of the specified object.
Public method Static member CreateItem(EditingContext, TypeIdentifier, Object[]) Creates a new model item for the specified type identifier.
Public method Static member CreateItem(EditingContext, Type, Object[]) Creates a new model item for the specified item type.
Public method Static member CreateItem(EditingContext, TypeIdentifier, CreateOptions, Object[]) Creates a new model item for the specified type identifier.
Public method Static member CreateItem(EditingContext, Type, CreateOptions, Object[]) Creates a new model item for the specified item type.
Public method Static member CreateStaticMemberItem(EditingContext, TypeIdentifier, String) Creates a new model item that represents the value of a static member of the specified class.
Public method Static member CreateStaticMemberItem(EditingContext, Type, String) Creates a new model item that represents the value of a static member of the specified class.
Public method Static member ResolveType Gets a resolved type for the specified TypeIdentifier.
Top

ModelFactory is designed to be a static API for convenience. The underlying implementation of this API simply calls the CreateItem method of ModelService.

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.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ