确定指定类型可否是指定的子类型的父级。
命名空间:  Microsoft.Windows.Design.Model
程序集:  Microsoft.Windows.Design.Interaction(在 Microsoft.Windows.Design.Interaction.dll 中)
语法
声明
Public Shared Function CanParent ( _
    context As EditingContext, _
    parent As ModelItem, _
    childType As Type _
) As Boolean
public static bool CanParent(
    EditingContext context,
    ModelItem parent,
    Type childType
)
public:
static bool CanParent(
    EditingContext^ context, 
    ModelItem^ parent, 
    Type^ childType
)
static member CanParent : 
        context:EditingContext * 
        parent:ModelItem * 
        childType:Type -> bool 
public static function CanParent(
    context : EditingContext, 
    parent : ModelItem, 
    childType : Type
) : boolean
参数
- context
 类型:Microsoft.Windows.Design.EditingContext
 要使用的编辑上下文。
- parent
 类型:Microsoft.Windows.Design.Model.ModelItem
 父级。
- childType
 类型:System.Type
 要寻找父级的项的类型。
返回值
类型:System.Boolean
如果指定的 parent 项可以接受 childType 的实例作为子级,则为 true;否则为 false。
备注
如果指定的 parent 项可以接受 childType 类型作为子级,则此方法将返回 true。 如果此方法返回 true,则对 Parent 方法的后续调用会将 parent 设置为 childType 的父级。
.NET Framework 安全性
- 对直接调用方的完全信任。此成员不能由部分信任的代码使用。有关更多信息,请参见通过部分受信任的代码使用库。
请参见
参考
Microsoft.Windows.Design.Model 命名空间