継承可能な添付プロパティがあります。
public static readonly DependencyProperty ResourcePackageProperty =
DependencyProperty.RegisterAttached("ResourcePackage", typeof(IResourcePackage), typeof(ResourceUIElement),
new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.Inherits));
コンテナー コントロールで、この添付プロパティを設定します => 子孫コントロールはこれを継承しますが、これは今のところ問題ありません。
今、私は次のようなバインディングを定義しようとしています:
var binding = new Binding();
binding.Source = proxy;
binding.Mode = BindingMode.OneWayToSource;
binding.Path = new PropertyPath("Value");
binding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;
BindingOperations.SetBinding(childControl, ResourceUIElement.ResourcePackageProperty, binding);
これは、childControl の ResourcePackage プロパティが変更されたときに、プロキシ オブジェクトの Value プロパティを更新することになっています。
これは、子コントロールに添付プロパティを直接設定すると機能しますが、コンテナー コントロールで添付プロパティが変更された (したがって、childControlに継承された) 場合は機能しません。
これは、WPF の依存関係プロパティ システムでまったく可能ですか?