ModelParent.CanParent 方法

判斷指定的型別是否可以做為指定之子型別的父代。

命名空間:  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

參數

  • childType
    型別:System.Type
    您要設定為父項目之項目的型別

傳回值

型別:System.Boolean
如果指定的 parent 項目可以接受 childType 的執行個體做為子系則為 true,否則為 false。

備註

如果指定的 parent 項目可以接受 childType 型別做為子系,則這個方法會傳回 true。 如果這個方法傳回 true,則後續呼叫 Parent 方法會將 parent 設定為 childType 的父代。

.NET Framework 安全性

請參閱

參考

ModelParent 類別

Microsoft.Windows.Design.Model 命名空間

其他資源

WPF 設計工具擴充性架構