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

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

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

                CoerceValue(ValueRangeTextBox.ValueProperty);

                CoerceValue(ValueRangeTextBox.NullValueProperty);

                CoerceValue(TextBox.TextProperty);
            }
            catch (Exception exception)
            {
                throw new InvalidOperationException("Initialization of the ValueRangeTextBox failed.", exception);
            }
            finally
            {
                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);
        }