Exemple #1
0
        private static void OnToolTipNumericFormatChanged(DependencyObject source, DependencyPropertyChangedEventArgs e)
        {
            NumericTextBox <T> sourceControl = source as NumericTextBox <T>;

            if (sourceControl.IsInitialized && sourceControl.HasValidationError)
            {
                sourceControl.Validate();
            }
        }
Exemple #2
0
        private static void OnMaximumChanged(DependencyObject source, DependencyPropertyChangedEventArgs e)
        {
            if (!source.IsInitial(MinimumProperty) && (e.NewValue as IComparable).CompareTo(source.GetValue(MinimumProperty)) < 0)
            {
                throw new ArgumentOutOfRangeException("Maximum", "Maximum has to be higher or equal to Minimum.");
            }

            NumericTextBox <T> sourceControl = source as NumericTextBox <T>;

            sourceControl.UpdateNotificationText();

            if (sourceControl.IsInitialized)
            {
                sourceControl.RefreshDisplayedValue();
            }
        }
Exemple #3
0
        private static void OnValueChanged(DependencyObject source, DependencyPropertyChangedEventArgs e)
        {
            NumericTextBox <T> sourceControl = source as NumericTextBox <T>;

            if (sourceControl.valueModified)
            {
                sourceControl.valueModified = false;
                return;
            }

            sourceControl.Text = sourceControl.FormatValueString((T)e.NewValue);

            if (sourceControl.IsInitialized)
            {
                sourceControl.RefreshDisplayedValue();
            }
        }