Dela via


ParentAdapter Class

Provides an extension point for any type that can be a parent of child objects.

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

Syntax

'Declaration
Public MustInherit Class ParentAdapter _
    Inherits Adapter
'Usage
Dim instance As ParentAdapter
public abstract class ParentAdapter : Adapter
public ref class ParentAdapter abstract : public Adapter
public abstract class ParentAdapter extends Adapter

Remarks

Inherit from ParentAdapter to specify a parent-child relationship in the WPF Designer.

It is frequently the case in Windows Presentation Foundation (WPF) that moving an element from one child to another or adding an element to a parent requires specialized knowledge of the parent-child relationship. Rather than implementing container-specific logic for each container, the ParentAdapter class defines an extensibility point and supports a generic mechanism for changing the parent of one object into another.

A ParentAdapter is invoked by the Parent method. The ModelParent locates a ParentAdapter for current and proposed parent objects. If no ParentAdapter exists, an object cannot be assigned a parent.

The ParentAdapter class enables containers to perform logic when a parent is removed. For example, if an object is being moved from a Canvas to a Grid, the canvas’s attached properties can be removed automatically.

Inheritance Hierarchy

System.Object
  Microsoft.Windows.Design.Features.FeatureProvider
    Microsoft.Windows.Design.Interaction.Adapter
      Microsoft.Windows.Design.Interaction.ParentAdapter

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

ParentAdapter Members

Microsoft.Windows.Design.Interaction Namespace

ModelParent

ModelItem

Other Resources

WPF Designer Extensibility