クラス階層外のクラスで添付された依存関係プロパティを定義し、所有者を共通の親クラスに設定すると、このエラーが発生します。
WindowBase クラスに添付された依存関係プロパティ (クラス階層外 => エラーが発生):
public static readonly DependencyProperty AreaColorProperty =
DependencyProperty.RegisterAttached("AreaColor", typeof(AreaColor), typeof(Window));
失敗する TemplateBinding
{TemplateBinding local:WindowBase.AreaColor}
代わりに、クラス階層内のクラスで添付の依存関係プロパティを定義し、所有者をこのクラスに設定すると、エラーが発生しません。なぜですか?
WindowBase に添付された依存関係プロパティ (クラス階層内 => エラーなし):
public static readonly DependencyProperty AreaColorProperty =
DependencyProperty.RegisterAttached("AreaColor", typeof(AreaColor), typeof(WindowBase));
よろしく、ジェスパー