为指定的项类型创建一个新的模型项。
命名空间:  Microsoft.Windows.Design.Model
程序集:  Microsoft.Windows.Design.Interaction(在 Microsoft.Windows.Design.Interaction.dll 中)
语法
声明
Public Shared Function CreateItem ( _
    context As EditingContext, _
    itemType As Type, _
    options As CreateOptions, _
    ParamArray arguments As Object() _
) As ModelItem
public static ModelItem CreateItem(
    EditingContext context,
    Type itemType,
    CreateOptions options,
    params Object[] arguments
)
public:
static ModelItem^ CreateItem(
    EditingContext^ context, 
    Type^ itemType, 
    CreateOptions options, 
    ... array<Object^>^ arguments
)
static member CreateItem : 
        context:EditingContext * 
        itemType:Type * 
        options:CreateOptions * 
        arguments:Object[] -> ModelItem 
public static function CreateItem(
    context : EditingContext, 
    itemType : Type, 
    options : CreateOptions, 
    ... arguments : Object[]
) : ModelItem
参数
- context
 类型:Microsoft.Windows.Design.EditingContext
 一个 EditingContext,表示设计器的编辑上下文。
- itemType
 类型:System.Type
 一个 Type,表示要创建的项的类型。
- options
 类型:Microsoft.Windows.Design.Model.CreateOptions
 创建该项时要使用的一组创建选项。默认值为 None。
- arguments
 类型:array<System.Object[]
 一个应传递给该项的构造函数的可选参数数组。
返回值
类型:Microsoft.Windows.Design.Model.ModelItem
一个 ModelItem,表示新建的项类型。
异常
| 异常 | 条件 | 
|---|---|
| ArgumentNullException | itemType 或 context 为 nullnull 引用(在 Visual Basic 中为 Nothing)。 | 
| ArgumentOutOfRangeException | options 无效。 | 
| InvalidOperationException | 上下文中没有可创建新项的编辑模型。 | 
.NET Framework 安全性
- 对直接调用方的完全信任。此成员不能由部分信任的代码使用。有关更多信息,请参见通过部分受信任的代码使用库。
请参见
参考
Microsoft.Windows.Design.Model 命名空间