Share via


ParentAdapter.CanParent Method

Gets a value indicating whether the specified parent object can be a parent to an object of the specified type.

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

Syntax

'Declaration
Public Overridable Function CanParent ( _
    parent As ModelItem, _
    childType As Type _
) As Boolean
public virtual bool CanParent(
    ModelItem parent,
    Type childType
)
public:
virtual bool CanParent(
    ModelItem^ parent, 
    Type^ childType
)
abstract CanParent : 
        parent:ModelItem * 
        childType:Type -> bool 
override CanParent : 
        parent:ModelItem * 
        childType:Type -> bool 
public function CanParent(
    parent : ModelItem, 
    childType : Type
) : boolean

Parameters

Return Value

Type: System.Boolean
true if the specified parent can accept a child of the specified type; otherwise, false. The default is true.

Exceptions

Exception Condition
ArgumentNullException

parent or childType is nulla null reference (Nothing in Visual Basic).

Remarks

Use CanParent for drag operations of live objects on the design surface and for drag operations of items from the Toolbox.

The default implementation returns true, which indicates that the parent supports all children.

.NET Framework Security

See Also

Reference

ParentAdapter Class

Microsoft.Windows.Design.Interaction Namespace

ModelParent

ModelItem

Other Resources

WPF Designer Extensibility