Пример #1
0
        private static void OnValueChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            NumericTextBox numeric = d as NumericTextBox;

            if (numeric != null)
            {
                numeric.SetText(e.NewValue);
            }
        }
Пример #2
0
        private static object CoerceMaximum(DependencyObject d, object baseValue)
        {
            NumericTextBox numeric = d as NumericTextBox;
            float          min     = numeric.Minimum;

            if (baseValue == null || min > (float)baseValue)
            {
                return(min);
            }

            return(baseValue);
        }
Пример #3
0
        private static object CoerceValue(DependencyObject d, object baseValue)
        {
            NumericTextBox numeric = d as NumericTextBox;
            float          min     = numeric.Minimum;

            if (baseValue == null || min > (float)baseValue)
            {
                numeric.SetText(min);
                return(min);
            }

            float max = numeric.Maximum;

            if ((float)baseValue > max)
            {
                numeric.SetText(max);
                return(max);
            }

            return(baseValue);
        }
Пример #4
0
        private static void OnMaximumChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            NumericTextBox numeric = d as NumericTextBox;

            numeric.CoerceValue(ValueProperty);
        }