/// <summary> /// MinimumProperty property changed handler. /// </summary> /// <param name="d">RangeBase that changed its Minimum.</param> /// <param name="e">DependencyPropertyChangedEventArgs.</param> /// private static void OnMinimumPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { RangeBase range = d as RangeBase; Debug.Assert(range != null); // Ensure it's a valid value if (!IsValidDoubleValue(e.NewValue)) { throw new ArgumentException(); } // Note: this section is a workaround, containing my // logic to hold all calls to the property changed // methods until after all coercion has completed // ---------- if (range._levelsFromRootCall == 0) { range._initialMax = range.Maximum; range._initialVal = range.Value; } range._levelsFromRootCall++; // ---------- range.CoerceMaximum(); range.CoerceValue(); // Note: this section completes my workaround to call // the property changed logic if all coercion has completed // ---------- range._levelsFromRootCall--; if (range._levelsFromRootCall == 0) { range.OnMinimumChanged((double)e.OldValue, (double)e.NewValue); // UIA event range.RaiseChangeEvent(Change.Minimum, (double)e.OldValue, (double)e.NewValue); double maximum = range.Maximum; if (range._initialMax != maximum) { range.OnMaximumChanged(range._initialMax, maximum); // UIA event range.RaiseChangeEvent(Change.Maximum, range._initialMax, maximum); } double value = range.Value; if (range._initialVal != value) { range.OnValueChanged(range._initialVal, value); } } // ---------- }
/// <summary> /// SmallChangeProperty property changed handler. /// </summary> /// <param name="d">RangeBase that changed its SmallChange.</param> /// <param name="e">DependencyPropertyChangedEventArgs.</param> private static void OnSmallChangePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { RangeBase range = d as RangeBase; Debug.Assert(range != null); // Ensure it's a valid value if (!IsValidChange(e.NewValue)) { throw new ArgumentException(); } // UIA event range.RaiseChangeEvent(Change.Small, (double)e.OldValue, (double)e.NewValue); }