ParentAdapter Class
Provides an extension point for any type that can be a parent of child objects.
Microsoft.Windows.Design.Features.FeatureProvider
Microsoft.Windows.Design.Interaction.Adapter
Microsoft.Windows.Design.Interaction.ParentAdapter
Assembly: Microsoft.Windows.Design.Interaction (in Microsoft.Windows.Design.Interaction.dll)
The ParentAdapter type exposes the following members.
| Name | Description | |
|---|---|---|
|
AdapterType | Gets the type of adapter this class represents. (Overrides Adapter.AdapterType.) |
| Name | Description | |
|---|---|---|
|
CanParent | Gets a value indicating whether the specified parent object can be a parent to an object of the specified type. |
|
Equals | Determines whether the specified Object is equal to the current Object. (Inherited from Object.) |
|
Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) |
|
GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) |
|
GetType | Gets the Type of the current instance. (Inherited from Object.) |
|
IsParent | Gets a value indicating whether the specified child item is a child of the specified parent item. |
|
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) |
|
Parent(ModelItem, ModelItem) | Changes the parent of an object to another parent. |
|
Parent(ModelItem, ModelItem, Int32) | Changes the parent of an object to another parent. |
|
RedirectParent | Redirect a reference from one parent to another. . |
|
RemoveParent | Replaces the current parent of the specified child with a new parent. |
|
ToString | Returns a string that represents the current object. (Inherited from Object.) |
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.