Exemple #1
0
        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 MouseWheelLogicalScrollBehavior(MouseWheelScrollClient scrollClient, IDisposable manipulator)
            : base(scrollClient, manipulator)
        {
            var element = Client.Controller.Element;

            if (scrollClient.Orientation == Orientation.Vertical)
            {
                Debouncing      = MouseWheel.GetLogicalVScrollDebouncing(element);
                ScrollIncrement = MouseWheel.GetLogicalVScrollIncrement(element);
                MouseWheel.LogicalVScrollDebouncingProperty.AddValueChanged(element, OnDebouncingYChanged);
                MouseWheel.LogicalVScrollIncrementProperty.AddValueChanged(element, OnVScrollIncrementChanged);
            }
            else
            {
                Debouncing      = MouseWheel.GetLogicalHScrollDebouncing(element);
                ScrollIncrement = MouseWheel.GetLogicalHScrollIncrement(element);
                MouseWheel.LogicalHScrollDebouncingProperty.AddValueChanged(element, OnDebouncingXChanged);
                MouseWheel.LogicalHScrollIncrementProperty.AddValueChanged(element, OnHScrollIncrementChanged);
            }
        }
 private void OnVScrollIncrementChanged(object sender, EventArgs e)
 {
     ScrollIncrement = MouseWheel.GetLogicalVScrollIncrement(sender as DependencyObject);
 }