Beispiel #1
0
 public static DependencyProperty Attach <D, T>(Meta <DependencyObject, T> meta, PropertyValidate <T> validation = null, [CallerMemberName] string autoFieldName = null)
 => DependencyProperty.RegisterAttached(GetPropertyName(autoFieldName), typeof(T), typeof(D),
                                        new FrameworkPropertyMetadata(meta.DefaultValue, meta.Flags, meta.ChangedCallback.TryInvoke,
                                                                      meta.CoerceCallback.TryInvoke), validation.TryInvoke);
Beispiel #2
0
 public static DependencyProperty Add <D, T>(this DependencyProperty property, Meta <D, T> meta, DPExtOptions options = DPExtOptions.None) where D : DependencyObject
 => property.AddOwner(typeof(D), new FrameworkPropertyMetadata(options == DPExtOptions.ForceManualInherit ? property.DefaultMetadata.DefaultValue : meta.DefaultValue, meta.Flags,
                                                               meta.ChangedCallback.TryInvoke, meta.CoerceCallback.TryInvoke));