ModelFactory Class

Used to create instances of model items in the designer.

Inheritance Hierarchy

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

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

Syntax

'Declaration
Public NotInheritable Class ModelFactory
public static class ModelFactory
public ref class ModelFactory abstract sealed
[<AbstractClass>]
[<Sealed>]
type ModelFactory =  class end
public final class ModelFactory

The ModelFactory type exposes the following members.

Methods

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

Top

Remarks

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.

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

Editing Model Architecture