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); } }
public MouseWheelPhysicalScrollBehavior(MouseWheelScrollClient scrollClient, IDisposable manipulator) : base(scrollClient, manipulator) { var element = Client.Controller.Element; if (scrollClient.Orientation == Orientation.Vertical) { Debouncing = MouseWheel.GetPhysicalVScrollDebouncing(element); ScrollIncrement = MouseWheel.GetPhysicalVScrollIncrement(element); MouseWheel.PhysicalVScrollDebouncingProperty.AddValueChanged(element, OnDebouncingYChanged); MouseWheel.PhysicalVScrollIncrementProperty.AddValueChanged(element, OnVScrollIncrementChanged); } else { Debouncing = MouseWheel.GetPhysicalHScrollDebouncing(element); ScrollIncrement = MouseWheel.GetPhysicalHScrollIncrement(element); MouseWheel.PhysicalHScrollDebouncingProperty.AddValueChanged(element, OnDebouncingXChanged); MouseWheel.PhysicalHScrollIncrementProperty.AddValueChanged(element, OnHScrollIncrementChanged); } }
private void OnHScrollIncrementChanged(object sender, EventArgs e) { ScrollIncrement = MouseWheel.GetPhysicalHScrollIncrement(sender as DependencyObject); }