protected MultiValueDeclaration(IEnumerable <T> values,
                                 IStyleVariableAccessor variableAccessor,
                                 DeclarationProperty property)
     : base(variableAccessor, property)
 {
     _values = new List <T>(values);
 }
 public ColorDeclaration(String value,
                         DeclarationProperty property,
                         IStyleVariableAccessor variableAccessor)
     : base(GetBrush(value, variableAccessor),
            variableAccessor, property)
 {
 }
示例#3
0
 private IStyleRule Rule <TValue>(TValue value,
                                  DeclarationProperty declarationProperty)
 {
     return(new DependencyPropertyValueRule <TValue>(
                AllStyleSelector.Instance,
                new ValueDeclaration <TValue>(value, _variableAccessor, declarationProperty)));
 }
 public EnumDeclaration(TEnum value,
                        IStyleVariableAccessor variableAccessor,
                        DeclarationProperty property)
     : base(value, variableAccessor, property)
 {
     //Value = value;
 }
 public DoubleDeclaration(String value,
                          IStyleVariableAccessor variableAccessor,
                          DeclarationProperty property)
     : base(variableAccessor, property)
 {
     Value = Double.TryParse(value, out var val) ? val : Double.NaN;
 }
 public DoubleDeclaration(Double value,
                          IStyleVariableAccessor variableAccessor,
                          DeclarationProperty property)
     : base(variableAccessor, property)
 {
     Value = value;
 }
 public EnumDeclaration(String value,
                        TEnum defaultValue,
                        IStyleVariableAccessor variableAccessor,
                        DeclarationProperty property)
     : base(GetEnumValue(value, defaultValue),
            variableAccessor, property)
 {
     //Value = GetEnumValue(value, defaultValue);
 }
示例#8
0
 private IStyleRule Rule <TValue>(VisualStateType state,
                                  TValue value,
                                  DeclarationProperty declarationProperty)
 {
     return(new StyleValueRule(Select(state),
                               new List <IStyleDeclaration>
     {
         new ValueDeclaration <TValue>(value, _variableAccessor, declarationProperty)
     }));
 }
示例#9
0
        //private static void OnTextChanged(Label sender,
        //                                  String oldValue, String newValue)
        //{
        //    sender.InvalidateMeasure();
        //}

        public override Boolean TryGetDependencyProperty(DeclarationProperty declarationProperty,
                                                         out IDependencyProperty property)
        {
            switch (declarationProperty)
            {
            case DeclarationProperty.Color:
                property = TextBrushProperty;
                return(true);

            default:
                return(base.TryGetDependencyProperty(declarationProperty, out property));
            }
        }
        public QuantifiedNumericDeclaration(String value,
                                            Dictionary <String, TQuantity> quantitySearch,
                                            TQuantity defaultValue,
                                            IStyleVariableAccessor variableAccessor,
                                            DeclarationProperty property)
            : base(variableAccessor, property)
        {
            var endOfValue = -1;

            for (var c = value.Length - 1; c >= 0; c--)
            {
                if (!Char.IsDigit(value[c]))
                {
                    continue;
                }

                endOfValue = c;
                break;
            }

            if (endOfValue == -1)
            {
                return;
            }

            var unitStr = value.Substring(endOfValue + 1);

            if (quantitySearch.TryGetValue(unitStr, out var enumVal))
            {
                Units = enumVal;
            }
            else
            {
                Units = GetEnumValue(unitStr, defaultValue);
            }

            Value = Double.Parse(value.Substring(0, endOfValue + 1));
        }
 protected QuadQuantityDeclaration(String value,
                                   IStyleVariableAccessor variableAccessor,
                                   DeclarationProperty property)
     : base(QuantifiedThickness.Parse(value), variableAccessor, property)
 {
 }
示例#12
0
 public StringDeclaration(String value,
                          IStyleVariableAccessor variableAccessor,
                          DeclarationProperty property)
     : base(value, variableAccessor, property)
 {
 }
示例#13
0
        public virtual Boolean TryGetDependencyProperty(DeclarationProperty declarationProperty,
                                                        out IDependencyProperty property)
        {
            IDependencyProperty?dependencyProperty = default;


            switch (declarationProperty)
            {
            case DeclarationProperty.BackgroundColor:
                dependencyProperty = BackgroundProperty;
                break;

            case DeclarationProperty.BorderRadius:
            case DeclarationProperty.BorderRadiusBottom:
            case DeclarationProperty.BorderRadiusLeft:
            case DeclarationProperty.BorderRadiusRight:
            case DeclarationProperty.BorderRadiusTop:
                dependencyProperty = BorderRadiusProperty;
                break;

            case DeclarationProperty.Border:
                dependencyProperty = BorderProperty;
                break;

            case DeclarationProperty.Height:
                dependencyProperty = HeightProperty;
                break;

            case DeclarationProperty.Margin:
            case DeclarationProperty.MarginBottom:
            case DeclarationProperty.MarginLeft:
            case DeclarationProperty.MarginRight:
            case DeclarationProperty.MarginTop:
                dependencyProperty = MarginProperty;
                break;

            case DeclarationProperty.Width:
                dependencyProperty = WidthProperty;
                break;

            case DeclarationProperty.ZIndex:
                dependencyProperty = ZIndexProperty;
                break;

            case DeclarationProperty.VerticalAlign:
                dependencyProperty = VerticalAlignmentProperty;
                break;

            case DeclarationProperty.Appearance:
                dependencyProperty = VisibilityProperty;
                break;

            case DeclarationProperty.Transform:
                dependencyProperty = TransformProperty;
                break;

            case DeclarationProperty.Top:
                dependencyProperty = TopProperty;
                break;

            case DeclarationProperty.Left:
                dependencyProperty = LeftProperty;
                break;

            case DeclarationProperty.Right:
                dependencyProperty = RightProperty;
                break;

            case DeclarationProperty.Bottom:
                dependencyProperty = BottomProperty;
                break;

            case DeclarationProperty.BoxShadow:
                dependencyProperty = BoxShadowProperty;
                break;

            case DeclarationProperty.Transition:
                break;
            }

            property = dependencyProperty !;

            return(dependencyProperty != null);
        }
 public ScalarDeclaration(String value,
                          IStyleVariableAccessor variableAccessor,
                          DeclarationProperty property)
     : this((T)Convert.ChangeType(value, typeof(T)), variableAccessor, property)
 {
 }
 public ScalarDeclaration(T value,
                          IStyleVariableAccessor variableAccessor,
                          DeclarationProperty property)
     : base(value, variableAccessor, property)
 {
 }
示例#16
0
 public QuantityDeclaration(String value,
                            IStyleVariableAccessor variableAccessor,
                            DeclarationProperty property)
     : base(QuantifiedDouble.Parse(value), variableAccessor, property)
 {
 }
 protected DeclarationBase(IStyleVariableAccessor variableAccessor,
                           DeclarationProperty property)
 {
     _variableAccessor = variableAccessor;
     Property          = property;
 }