public static AttachedProperty <T> Register <TOwner, T>([NotNull] string name, T defaultValue = default(T)) { if (name == null) { throw new ArgumentNullException(nameof(name)); } var identifier = new AttachableMemberIdentifier(typeof(TOwner), name); var property = new AttachedProperty <T>(identifier, defaultValue); _Properties.Add(identifier, property); return(property); }
public static T Set <T, TValue>([NotNull] this T @this, [NotNull] AttachedProperty <TValue> property, TValue value) where T : Element, new() { (@this ?? throw new ArgumentNullException(nameof(@this))).Values.Add(property, value); return(@this); }
private static AttachedProperty <T> RegisterAttached <T>(Expression <Func <AttachedProperty <T> > > nameExpression, T defaultValue = default(T)) => AttachedProperty.Register <Dock, T>(nameExpression, defaultValue);
private static AttachedProperty <T> RegisterAttached <T>([NotNull] Expression <Func <AttachedProperty <T> > > nameExpression, T defaultValue = default) => AttachedProperty.Register <Canvas, T>(nameExpression, defaultValue);
public static void Add <T>(this ValuesInitializer @this, AttachedProperty <T> property, T value) => @this.Object[property] = value;
public static bool HasValueSafe <T>([NotNull] this BindableObject @this, [NotNull] AttachedProperty <T> property) => (@this ?? throw new ArgumentNullException(nameof(@this))).HasValue(property ?? throw new ArgumentException(nameof(property)));
public static void ResetValueSafe <T>(this BindableObject @this, [NotNull] AttachedProperty <T> property) => (@this ?? throw new ArgumentNullException(nameof(@this))).ResetValue(property);
public AttachedValue(AttachedProperty <T> property, T value) { Property = property; Value = value; }