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);
        }
示例#2
0
 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);
 }
示例#3
0
 private static AttachedProperty <T> RegisterAttached <T>(Expression <Func <AttachedProperty <T> > > nameExpression, T defaultValue = default(T)) =>
 AttachedProperty.Register <Dock, T>(nameExpression, defaultValue);
示例#4
0
 private static AttachedProperty <T> RegisterAttached <T>([NotNull] Expression <Func <AttachedProperty <T> > > nameExpression, T defaultValue = default) =>
 AttachedProperty.Register <Canvas, T>(nameExpression, defaultValue);
示例#5
0
 public static void Add <T>(this ValuesInitializer @this, AttachedProperty <T> property, T value) =>
 @this.Object[property] = value;
示例#6
0
 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);
示例#8
0
 public AttachedValue(AttachedProperty <T> property, T value)
 {
     Property = property;
     Value    = value;
 }