Пример #1
0
        static void TaskSetFormatText(FrameworkElement fe, string route, PropertyRoute context)
        {
            ValueLine vl = fe as ValueLine;

            if (vl != null && vl.NotSet(ValueLine.FormatProperty) && context.PropertyRouteType == PropertyRouteType.FieldOrProperty)
            {
                string format = Reflector.FormatString(context);
                if (format != null)
                {
                    vl.Format = format;
                }
            }
        }
Пример #2
0
        static void TaskSetNotNullItemsSource(FrameworkElement fe, string route, PropertyRoute context)
        {
            ValueLine vl = fe as ValueLine;

            if (vl != null && vl.NotSet(ValueLine.ItemSourceProperty) && context.PropertyRouteType == PropertyRouteType.FieldOrProperty)
            {
                if (context.Type.IsNullable() && context.Type.UnNullify().IsEnum&&
                    Validator.TryGetPropertyValidator(context).Let(pv => pv != null && pv.Validators.OfType <NotNullValidatorAttribute>().Any()))
                {
                    vl.ItemSource = EnumExtensions.UntypedGetValues(vl.Type.UnNullify()).ToObservableCollection();
                }
            }
        }
Пример #3
0
        static void TaskSetUnitText(FrameworkElement fe, string route, PropertyRoute context)
        {
            ValueLine vl = fe as ValueLine;

            if (vl != null && vl.NotSet(ValueLine.UnitTextProperty) && context.PropertyRouteType == PropertyRouteType.FieldOrProperty)
            {
                UnitAttribute ua = context.PropertyInfo.GetCustomAttribute <UnitAttribute>();
                if (ua != null)
                {
                    vl.UnitText = ua.UnitName;
                }
            }
        }