private static void OnMapPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { Magnifier obj = (Magnifier)d; Map newValue = (Map)e.NewValue; Map oldValue = (Map)e.OldValue; if (oldValue != null) { oldValue.RotationChanged -= obj.Map_RotationChanged; obj.rootElement.MouseMove -= obj.dragGlass; obj.rootElement = null; } if (newValue != null) { newValue.RotationChanged += obj.Map_RotationChanged; if (obj.bigMap != null) { obj.bigMap.WrapAround = newValue.WrapAround; } obj.rootElement = newValue.Parent as FrameworkElement; if (obj.rootElement != null) { obj.rootElement.MouseMove += obj.dragGlass; } obj.SetVisualSize(); } }
private static void OnLayersPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { Magnifier m = d as Magnifier; if (m.bigMap != null) { m.bigMap.Layers = e.NewValue as LayerCollection; } m.SetVisualSize(); }