Пример #1
0
 public ThicknessStyleKey(string name, StyleKey <Unit> top, StyleKey <Unit> left, StyleKey <Unit> bottom, StyleKey <Unit> right) : base(name, false)
 {
     Top    = top;
     Left   = left;
     Bottom = bottom;
     Right  = right;
 }
Пример #2
0
        public void Set <T>(StyleKey <T> key, [DisallowNull] T field)
        {
            if (key is null)
            {
                throw new ArgumentNullException(nameof(key));
            }

            if (field is null)
            {
                throw new ArgumentNullException(nameof(field));
            }

            var fieldType = field.GetType();

            if (!fieldType.IsAssignableFrom(typeof(T)))
            {
                throw new ArgumentException($"Cannot assign value of type {fieldType.FormattedName()} to property {key.Name}.");
            }

            container.Set(key.Name, field);
        }