Share via


ModelFactory.CreateItem Method (EditingContext, Type, array<Object )

Creates a new model item for the specified item type.

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

Syntax

'Declaration
Public Shared Function CreateItem ( _
    context As EditingContext, _
    itemType As Type, _
    ParamArray arguments As Object() _
) As ModelItem
public static ModelItem CreateItem(
    EditingContext context,
    Type itemType,
    params Object[] arguments
)
public:
static ModelItem^ CreateItem(
    EditingContext^ context, 
    Type^ itemType, 
    ... array<Object^>^ arguments
)
static member CreateItem : 
        context:EditingContext * 
        itemType:Type * 
        arguments:Object[] -> ModelItem 
public static function CreateItem(
    context : EditingContext, 
    itemType : Type, 
    ... arguments : Object[]
) : ModelItem

Parameters

  • itemType
    Type: System.Type
    A Type representing the type of item to create.
  • arguments
    Type: array<System.Object[]
    An optional array of arguments that should be passed to the constructor of the item.

Return Value

Type: Microsoft.Windows.Design.Model.ModelItem
A ModelItem that represents the newly created item type.

Exceptions

Exception Condition
ArgumentNullException

itemType or context is nulla null reference (Nothing in Visual Basic).

InvalidOperationException

There is no editing model in the context that can create new items.

.NET Framework Security

See Also

Reference

ModelFactory Class

CreateItem Overload

Microsoft.Windows.Design.Model Namespace

Other Resources

WPF Designer Extensibility

Editing Model Architecture