CoerceValue() private static method

private static CoerceValue ( DependencyObject d, object value ) : object
d DependencyObject
value object
return object
Exemplo n.º 1
0
        private static void OnMinimumChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            NumericUpDown numericUpDown = (NumericUpDown)d;

            numericUpDown.CoerceValue(NumericUpDown.ValueProperty);
            numericUpDown.CoerceValue(NumericUpDown.MaximumProperty);
            numericUpDown.Value = (double?)NumericUpDown.CoerceValue(numericUpDown, numericUpDown.Value);
            numericUpDown.OnMinimumChanged((double)e.OldValue, (double)e.NewValue);
            numericUpDown.EnableDisableUpDown();
        }
Exemplo n.º 2
0
        private void OnTextChanged(object sender, TextChangedEventArgs e)
        {
            double num;

            if (string.IsNullOrEmpty(((TextBox)sender).Text))
            {
                this.Value = null;
                return;
            }
            if (this._manualChange && this.ValidateText(((TextBox)sender).Text, out num))
            {
                this.Value = (double?)NumericUpDown.CoerceValue(this, num);
                e.Handled  = true;
            }
        }
Exemplo n.º 3
0
        private void ChangeValueBy(double difference)
        {
            double valueOrDefault = this.Value.GetValueOrDefault() + difference;

            this.Value = new double?((double)NumericUpDown.CoerceValue(this, valueOrDefault));
        }