Inheritance: System.Windows.Controls.Control
Exemplo n.º 1
0
 /// <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;
     }
 }
Exemplo n.º 2
0
        private static void OnOceanFillPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            LargeWorldGlobe globe = d as LargeWorldGlobe;
            Brush           brush = e.NewValue as Brush;

            globe.oceanFill = brush;
            if (globe.OceanEllipse != null)
            {
                globe.OceanEllipse.Fill = brush;
            }
        }
Exemplo n.º 3
0
        private static void OnLandFillPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            LargeWorldGlobe globe = d as LargeWorldGlobe;
            Brush           brush = e.NewValue as Brush;

            globe.landFill = brush;
            if (globe.LandPath != null)
            {
                globe.LandPath.Fill = brush;
            }
        }
Exemplo n.º 4
0
        private static void OnScalePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            LargeWorldGlobe globe = d as LargeWorldGlobe;
            double          value = Convert.ToDouble(e.NewValue);

            globe.scale = value;
            if (globe.GlobeScale != null)
            {
                globe.GlobeScale.ScaleX = value;
                globe.GlobeScale.ScaleY = value;
            }
        }
Exemplo n.º 5
0
        private static void OnExpandOnMouseOverChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            LargeWorldGlobe globe = d as LargeWorldGlobe;
            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;
     }
 }