Inheritance: System.Windows.Controls.Control
コード例 #1
0
        private static void OnFaceFillPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            LargeCompass compass = d as LargeCompass;
            Brush        brush   = e.NewValue as Brush;

            compass.faceFill = brush;
            if (compass.CompassFace != null)
            {
                compass.CompassFace.Fill = brush;
            }
        }
コード例 #2
0
        private static void OnScalePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            LargeCompass compass = d as LargeCompass;
            double       value   = Convert.ToDouble(e.NewValue);

            compass.scale = value;
            if (compass.CompassScale != null)
            {
                compass.CompassScale.ScaleX = value;
                compass.CompassScale.ScaleY = value;
            }
        }
コード例 #3
0
        private static void OnExpandOnMouseOverChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            LargeCompass compass = d as LargeCompass;
            object       obj     = e.NewValue;

            if (obj != null)
            {
                compass.MouseEnter -= compass.compass_MouseEnter;
                compass.MouseLeave -= compass.compass_MouseLeave;
                bool expand = (bool)obj;
                compass.expandOnMouseOver = expand;
                if (expand)
                {
                    compass.MouseEnter += compass.compass_MouseEnter;
                    compass.MouseLeave += compass.compass_MouseLeave;
                }
            }
        }
コード例 #4
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()
 {
     compass      = this;
     CompassScale = GetTemplateChild("CompassScale") as ScaleTransform;
     CompassFace  = GetTemplateChild("compassFace") as Ellipse;
     if (scale != 1)
     {
         compass.CompassScale.ScaleX = scale;
         compass.CompassScale.ScaleY = scale;
     }
     if (expandOnMouseOver)
     {
         compass.MouseEnter += new MouseEventHandler(compass_MouseEnter);
         compass.MouseLeave += new MouseEventHandler(compass_MouseLeave);
     }
     if (faceFill != null)
     {
         CompassFace.Fill = faceFill;
     }
 }
コード例 #5
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()
 {
     compass = this;
     CompassScale = GetTemplateChild("CompassScale") as ScaleTransform;
     CompassFace = GetTemplateChild("compassFace") as Ellipse;
     if (scale != 1)
     {
         compass.CompassScale.ScaleX = scale;
         compass.CompassScale.ScaleY = scale;
     }
     if (expandOnMouseOver)
     {
         compass.MouseEnter += new MouseEventHandler(compass_MouseEnter);
         compass.MouseLeave += new MouseEventHandler(compass_MouseLeave);
     }
     if (faceFill != null)
         CompassFace.Fill = faceFill;
 }