/// <summary> /// When overridden in a derived class, is invoked whenever application code or /// internal processes (such as a rebuilding layout pass) call /// <see cref="M:System.Windows.Controls.Control.ApplyTemplate"/>. /// </summary> public override void OnApplyTemplate() { world = this; OceanEllipse = GetTemplateChild("OceanEllipse") as Ellipse; LandPath = GetTemplateChild("LandPath") as Path; GlobeScale = GetTemplateChild("GlobeScale") as ScaleTransform; if (oceanFill != null) { OceanEllipse.Fill = oceanFill; } if (landFill != null) { LandPath.Fill = landFill; } if (scale != 1) { GlobeScale.ScaleX = scale; world.GlobeScale.ScaleY = scale; } if (expandOnMouseOver) { world.MouseEnter += globe_MouseEnter; world.MouseLeave += globe_MouseLeave; } }
private static void OnOceanFillPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { WorldGlobe globe = d as WorldGlobe; Brush brush = e.NewValue as Brush; globe.oceanFill = brush; if (globe.OceanEllipse != null) { globe.OceanEllipse.Fill = brush; } }
private static void OnLandFillPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { WorldGlobe globe = d as WorldGlobe; Brush brush = e.NewValue as Brush; globe.landFill = brush; if (globe.LandPath != null) { globe.LandPath.Fill = brush; } }
private static void OnScalePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { WorldGlobe globe = d as WorldGlobe; double value = Convert.ToDouble(e.NewValue); globe.scale = value; if (globe.GlobeScale != null) { globe.GlobeScale.ScaleX = value; globe.GlobeScale.ScaleY = value; } }
private static void OnExpandOnMouseOverChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { WorldGlobe globe = d as WorldGlobe; object obj = e.NewValue; if (obj != null) { globe.MouseEnter -= globe.globe_MouseEnter; globe.MouseLeave -= globe.globe_MouseLeave; bool expand = (bool)obj; globe.expandOnMouseOver = expand; if (expand) { globe.MouseEnter += globe.globe_MouseEnter; globe.MouseLeave += globe.globe_MouseLeave; } } }
/// <summary> /// When overridden in a derived class, is invoked whenever application code or /// internal processes (such as a rebuilding layout pass) call /// <see cref="M:System.Windows.Controls.Control.ApplyTemplate"/>. /// </summary> public override void OnApplyTemplate() { world = this; OceanEllipse = GetTemplateChild("OceanEllipse") as Ellipse; LandPath = GetTemplateChild("LandPath") as Path; GlobeScale = GetTemplateChild("GlobeScale") as ScaleTransform; if (oceanFill != null) OceanEllipse.Fill = oceanFill; if (landFill != null) LandPath.Fill = landFill; if (scale != 1) { GlobeScale.ScaleX = scale; world.GlobeScale.ScaleY = scale; } if (expandOnMouseOver) { world.MouseEnter += globe_MouseEnter; world.MouseLeave += globe_MouseLeave; } }