상속: System.Windows.Controls.Control
예제 #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;
     }
 }
예제 #2
0
        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;
            }
        }
예제 #3
0
        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;
            }
        }
예제 #4
0
        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;
            }
        }
예제 #5
0
        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;
     }
 }