无论如何从附加属性类型上的属性更改回调中获取附加属性的实例?
换句话说,如果您有:
public class MyAttachedPropertyClass
{
public static readonly DependencyProperty MyProperty = DependencyProperty.RegisterAttached(
"My", typeof(int), typeof(MyAttachedPropertyClass), new FrameworkPropertyMetadata(0, OnMyPropertyChanged));
private static void OnMyPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
//TODO: access instance of MyAttachedPropertyClass
}
}
我需要访问 MyAttachedPropertyClass 的实例,以便我可以设置位于该类型上的另一个属性的值。