Share via


ParentAdapter Class

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

Inheritance Hierarchy

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

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

Syntax

'Declaration
Public MustInherit Class ParentAdapter _
    Inherits Adapter
public abstract class ParentAdapter : Adapter
public ref class ParentAdapter abstract : public Adapter
[<AbstractClass>]
type ParentAdapter =  
    class
        inherit Adapter
    end
public abstract class ParentAdapter extends Adapter

The ParentAdapter type exposes the following members.

Constructors

  Name Description
Protected method ParentAdapter Initializes a new instance of the ParentAdapter class.

Top

Properties

  Name Description
Public property AdapterType Gets the type of adapter this class represents. (Overrides Adapter.AdapterType.)

Top

Methods

  Name Description
Public method CanParent Gets a value indicating whether the specified parent object can be a parent to an object of the specified type.
Public method Equals Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected method Finalize Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public method GetHashCode Serves as a hash function for a particular type. (Inherited from Object.)
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Public method IsParent Gets a value indicating whether the specified child item is a child of the specified parent item.
Protected method MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Public method Parent(ModelItem, ModelItem) Changes the parent of an object to another parent.
Public method Parent(ModelItem, ModelItem, Int32) Changes the parent of an object to another parent.
Public method RedirectParent Redirect a reference from one parent to another. .
Public method RemoveParent Replaces the current parent of the specified child with a new parent.
Public method ToString Returns a string that represents the current object. (Inherited from Object.)

Top

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.

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

Microsoft.Windows.Design.Interaction Namespace

ModelParent

ModelItem

Other Resources

WPF Designer Extensibility