Limit attached dependency property in wpf
I want to attach a dependency property to specific controls only. If that is just one type, I can do this: public static readonly DependencyProperty MyPropertyProperty = DependencyProperty.RegisterAttached("MyProperty", typeof(object), typeof(ThisStaticWrapperClass)); public static object GetMyProperty(MyControl control) { if (control == null) { throw new ArgumentNullException("control"); } return control.GetValue(MyPropertyProperty); } public static void SetMyProperty(MyControl control, object value) { if (control == null) { throw new ArgumentNullException("control"); } control.SetValue