protected override void OnLoading() { base.OnLoading(); var element = Controller.Element; if (Orientation == Orientation.Vertical) { _scrollMode = MouseWheel.GetVScrollMode(element); _smoothing = MouseWheel.GetVScrollSmoothing(element); _modifiers = MouseWheel.GetVScrollModifiers(element); MouseWheel.VScrollModeProperty.AddValueChanged(element, OnVScrollModeChanged); MouseWheel.VScrollSmoothingProperty.AddValueChanged(element, OnVSmoothingChanged); MouseWheel.VScrollModifiersProperty.AddValueChanged(element, OnVModifiersChanged); MouseWheel.GetLogicalVScrollIncrement(element).SetOrientation(Orientation.Vertical); MouseWheel.GetPhysicalVScrollIncrement(element).SetOrientation(Orientation.Vertical); } else { _scrollMode = MouseWheel.GetHScrollMode(element); _smoothing = MouseWheel.GetHScrollSmoothing(element); _modifiers = MouseWheel.GetHScrollModifiers(element); MouseWheel.HScrollModeProperty.AddValueChanged(element, OnHScrollModeChanged); MouseWheel.HScrollSmoothingProperty.AddValueChanged(element, OnHSmoothingChanged); MouseWheel.HScrollModifiersProperty.AddValueChanged(element, OnHModifiersChanged); MouseWheel.GetLogicalHScrollIncrement(element).SetOrientation(Orientation.Horizontal); MouseWheel.GetPhysicalHScrollIncrement(element).SetOrientation(Orientation.Horizontal); } }
private void OnHSmoothingChanged(object sender, EventArgs e) { Smoothing = MouseWheel.GetHScrollSmoothing(sender as DependencyObject); }