次の方法で共有


ParentAdapter クラス

更新 : 2007 年 11 月

子オブジェクトの親になることのできる型の拡張ポイントを提供します。

名前空間 :  Microsoft.Windows.Design.Interaction
アセンブリ :  Microsoft.Windows.Design.Extensibility (Microsoft.Windows.Design.Extensibility.dll 内)

構文

'宣言
Public MustInherit Class ParentAdapter _
    Inherits Adapter
'使用
Dim instance As ParentAdapter
public abstract class ParentAdapter : Adapter
public ref class ParentAdapter abstract : public Adapter
public abstract class ParentAdapter extends Adapter

解説

WPF デザイナでの親子関係を指定するには、ParentAdapter から継承します。

1 つの子から別の子へ要素を移動したり、親に要素を追加したりする場合、Windows Presentation Foundation (WPF) では、親子関係についての深い知識が必要になることがよくあります。コンテナごとに固有のロジックを実装するのではなく、拡張ポイントを定義する ParentAdapter クラスによって、あるオブジェクトの親を別のオブジェクトに変更する汎用的な方法がサポートされます。

ParentAdapter は Parent メソッドによって呼び出されます。ModelParent は、現在の親オブジェクトおよび提案される親オブジェクトに対応する ParentAdapter を探します。ParentAdapter が存在しない場合、オブジェクトに親を割り当てることはできません。

ParentAdapter クラスを使用すると、親が削除されるときにコンテナでロジックを実行できます。たとえば、オブジェクトが Canvas から Grid に移動するとき、キャンバスの添付プロパティを自動的に削除することができます。

継承階層

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

スレッド セーフ

この型のすべてのパブリック static (Visual Basic では Shared) メンバは、スレッド セーフです。インスタンス メンバの場合は、スレッド セーフであるとは限りません。

参照

参照

ParentAdapter メンバ

Microsoft.Windows.Design.Interaction 名前空間

ModelParent

ModelItem

その他の技術情報

WPF デザイナの機能拡張