Beispiel #1
0
        private void Element_MouseWheel(object sender, MouseWheelEventArgs e)
        {
            var magnifier = MagnifierManager.GetMagnifier(_element) as Magnifier;

            if ((magnifier != null) && magnifier.IsUsingZoomOnMouseWheel)
            {
                if (e.Delta < 0)
                {
                    var newValue = magnifier.ZoomFactor + magnifier.ZoomFactorOnMouseWheel;
#if VS2008
                    magnifier.ZoomFactor = newValue;
#else
                    magnifier.SetCurrentValue(Magnifier.ZoomFactorProperty, newValue);
#endif
                }
                else if (e.Delta > 0)
                {
                    var newValue = (magnifier.ZoomFactor >= magnifier.ZoomFactorOnMouseWheel) ? magnifier.ZoomFactor - magnifier.ZoomFactorOnMouseWheel : 0d;
#if VS2008
                    magnifier.ZoomFactor = newValue;
#else
                    magnifier.SetCurrentValue(Magnifier.ZoomFactorProperty, newValue);
#endif
                }
                _adorner.UpdateViewBox();
            }
        }
    private static void OnMagnifierChanged( DependencyObject d, DependencyPropertyChangedEventArgs e )
    {
      UIElement target = d as UIElement;

      if( target == null )
        throw new ArgumentException( "Magnifier can only be attached to a UIElement." );

      MagnifierManager manager = new MagnifierManager();
      manager.AttachToMagnifier( target, e.NewValue as Magnifier );
    }
Beispiel #3
0
        private void Element_MouseLeave(object sender, MouseEventArgs e)
        {
            var magnifier = MagnifierManager.GetMagnifier(_element) as Magnifier;

            if ((magnifier != null) && magnifier.IsFrozen)
            {
                return;
            }

            HideAdorner();
        }
Beispiel #4
0
        private static void OnMagnifierChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            UIElement target = d as UIElement;

            if (target == null)
            {
                throw new ArgumentException("Magnifier can only be attached to a UIElement.");
            }

            MagnifierManager manager = new MagnifierManager();

            manager.AttachToMagnifier(target, e.NewValue as Magnifier);
        }