/// <summary> /// Our dependany property has changed, deal with it and ensure the Property change notification /// of INotifyPropertyChanges is triggered /// </summary> /// <param name="dependancy">the dependancy object</param> /// <param name="args">The <see cref="System.Windows.DependencyPropertyChangedEventArgs"/> instance containing the event data.</param> private static void ValuePropertyChanged(DependencyObject dependancy, DependencyPropertyChangedEventArgs args) { ColorPoint instance = dependancy as ColorPoint; if (instance != null) { instance.OnPropertyChanged("Value"); } }
/// <summary> /// Set the needle color from the range /// </summary> protected override void UpdateNeedleColor() { ColorPoint c = this.NeedleColorRange.GetColor(Value); if (c != null) { this._needle.Fill = new SolidColorBrush(c.HiColor); } }
protected override void UpdateNeedleColor() { ColorPoint c = NeedleColorRange.GetColor(Value); if (c != null) { this.needleHighColorGradientStop.Color = c.HiColor; this.needleLowColorGradientStop.Color = c.LowColor; } }
/// <summary> /// Set the face color from the range /// </summary> protected override void UpdateFaceColor() { ColorPoint c = FaceColorRange.GetColor(Value); if (c != null) { this._colourRangeStart.Color = c.HiColor; this._colourRangeEnd.Color = c.LowColor; } }
/// <summary> /// Set the needle color from the range /// </summary> protected override void UpdateNeedleColor() { ColorPoint c = NeedleColorRange.GetColor(Value); if (c != null) { _needleHighColour.Color = c.HiColor; _needleLowColour.Color = c.LowColor; } }
/// <summary> /// Finds the true and false representaions and dets the /// gradient stop colors for them /// </summary> /// <param name="el">The framework element</param> /// <param name="colorPoint">The colorPoint for the current value</param> /// <param name="id">The number of the element to set the color for</param> private static void UpdateColorsFromXaml(FrameworkElement el, ColorPoint colorPoint, string id) { if (el == null || colorPoint.HiColor == null || colorPoint.LowColor == null) { return; } GradientStop highStop = el.FindName(id + "HighColor") as GradientStop; GradientStop lowStop = el.FindName(id + "LowColor") as GradientStop; if (highStop != null && lowStop != null) { highStop.Color = colorPoint.HiColor; lowStop.Color = colorPoint.LowColor; } }
/// <summary> /// Sets the high and low colors from the Mercury color range /// </summary> private void UpdateMercuryColor() { ColorPoint c = this.MercuryColorRange.GetColor(Value); if (c != null) { for (int i = 0; i < 20; i++) { GradientStop gs = LayoutRoot.FindName("_mercL" + i) as GradientStop; if (gs != null) { gs.Color = c.LowColor; } gs = LayoutRoot.FindName("_mercH" + i) as GradientStop; if (gs != null) { gs.Color = c.HiColor; } } } }