Beispiel #1
0
        private static void BubbleMouseWheelProperty_PropertyChanged(DependencyObject o, DependencyPropertyChangedEventArgs e)
        {
            var Element = o as FrameworkElement;

            if (Element == null)
            {
                throw new ArgumentException("Type mismatch", "o");
            }

            var Value    = (bool)e.NewValue;
            var Listener = GetBubbleMouseWheelWeakEventListenerProperty(Element);

            if (Value)
            {
                if (Listener == null)
                {
                    Listener = new BubbleMouseWheelEventListener();
                }

                SetBubbleMouseWheelWeakEventListenerProperty(Element, Listener);
                PreviewMouseWheelEventManager.AddListener(Element, Listener);
            }
            else if (Listener != null)
            {
                SetBubbleMouseWheelWeakEventListenerProperty(Element, null);
                PreviewMouseWheelEventManager.RemoveListener(Element, Listener);
            }
        }
        private static void BubbleMouseWheelProperty_PropertyChanged(DependencyObject o, DependencyPropertyChangedEventArgs e)
        {
            var Element = o as FrameworkElement;
            if (Element == null)
                throw new ArgumentException("Type mismatch", "o");

            var Value = (bool)e.NewValue;
            var Listener = GetBubbleMouseWheelWeakEventListenerProperty(Element);
            if (Value)
            {
                if (Listener == null)
                    Listener = new BubbleMouseWheelEventListener();

                SetBubbleMouseWheelWeakEventListenerProperty(Element, Listener);
                PreviewMouseWheelEventManager.AddListener(Element, Listener);
            }
            else if (Listener != null)
            {
                SetBubbleMouseWheelWeakEventListenerProperty(Element, null);
                PreviewMouseWheelEventManager.RemoveListener(Element, Listener);
            }
        }