예제 #1
0
        protected override void OnInitialized(EventArgs e)
        {
            this.IsFinalizingInitialization = true;
            try
            {
                this.CoerceValue(ValueRangeTextBox.ValueDataTypeProperty);

                this.IsNumericValueDataType = ValueRangeTextBox.IsNumericType(this.ValueDataType);
                this.RefreshConversionHelpers();

                this.CoerceValue(ValueRangeTextBox.MinValueProperty);
                this.CoerceValue(ValueRangeTextBox.MaxValueProperty);

                this.CoerceValue(ValueRangeTextBox.ValueProperty);

                this.CoerceValue(ValueRangeTextBox.NullValueProperty);

                this.CoerceValue(ValueRangeTextBox.TextProperty);
            }
            catch (Exception exception)
            {
                throw new InvalidOperationException("Initialization of the ValueRangeTextBox failed.", exception);
            }
            finally
            {
                this.IsFinalizingInitialization = false;
            }

            base.OnInitialized(e);
        }
예제 #2
0
        private static void ValueDataTypePropertyChangedCallback(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            ValueRangeTextBox valueRangeTextBox = sender as ValueRangeTextBox;

            Type valueDataType = e.NewValue as Type;

            valueRangeTextBox.IsNumericValueDataType = ValueRangeTextBox.IsNumericType(valueDataType);

            valueRangeTextBox.RefreshConversionHelpers();

            valueRangeTextBox.ConvertValuesToDataType(valueDataType);
        }