Наследование: System.Windows.Controls.Control
        private static void OnMapPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            MagnifyingGlass mag = d as MagnifyingGlass;
            Map             old = e.OldValue as Map;

            if (old != null)             //clean up
            {
                if (mag.bigMap != null)
                {
                    mag.bigMap.Layers.Clear();
                }
                old.RotationChanged -= mag.map_RotationChanged;
                old.ExtentChanged   -= mag.map_ExtentChanged;
                old.ExtentChanging  -= mag.map_ExtentChanging;
            }
            Map newMap = e.NewValue as Map;

            if (newMap != null)
            {
                if (mag.bigMap != null)
                {
                    if (mag.Layer != null && !mag.bigMap.Layers.Any())                     // the layer may have laready b een added OnLayerChanegd or OnApplyTemplate events
                    {
                        mag.bigMap.Layers.Add(mag.Layer);
                    }
                    mag.bigMap.Rotation = newMap.Rotation;
                }
                newMap.RotationChanged += mag.map_RotationChanged;
                newMap.ExtentChanged   += mag.map_ExtentChanged;
                newMap.ExtentChanging  += mag.map_ExtentChanging;
            }
        }
Пример #2
0
        private static void OnMapPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            MagnifyingGlass mag = d as MagnifyingGlass;
            Map             old = e.OldValue as Map;

            if (old != null)             //clean up
            {
                if (mag.bigMap != null)
                {
                    mag.bigMap.Layers.Clear();
                }
                old.RotationChanged -= mag.map_RotationChanged;
                old.ExtentChanged   -= mag.map_ExtentChanged;
                old.ExtentChanging  -= mag.map_ExtentChanging;
            }
            Map newMap = e.NewValue as Map;

            if (newMap != null)
            {
                if (mag.bigMap != null)
                {
                    if (mag.Layer != null)
                    {
                        mag.bigMap.Layers.Add(mag.Layer);
                    }
                    mag.bigMap.Rotation = newMap.Rotation;
                }
                newMap.RotationChanged += mag.map_RotationChanged;
                newMap.ExtentChanged   += mag.map_ExtentChanged;
                newMap.ExtentChanging  += mag.map_ExtentChanging;
            }
        }
        private static void OnLayerPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            MagnifyingGlass mag = d as MagnifyingGlass;

            if (mag.bigMap != null)
            {
                mag.bigMap.Layers.Clear();
                if (mag.Layer != null)
                {
                    mag.bigMap.Layers.Add(mag.Layer);
                }
            }
        }
        private static void OnZoomFactorPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            MagnifyingGlass mag = d as MagnifyingGlass;

            mag.SetMagnifyResolution();
        }