/// <summary> /// Updates the mark on the scale object. /// </summary> private void UpdateScaleMark() { Scale s = ResourceRoot.FindName("_scale") as Scale; if (s != null) { s.Mark = Mark; } }
/// <summary> /// Updates the font style for both face and value text. /// </summary> protected override void UpdateFontStyle() { for (int i = 0; i <= 4; i++) { TextBlock tb = ResourceRoot.FindName("_txt" + i) as TextBlock; CopyFontDetails(tb); } CopyFontDetails(textBlock); }
/// <summary> /// Initialize references to controls we expect to find in the child /// </summary> private void InitialiseRefs() { this.grabHandleCanvas = ResourceRoot.FindName("_grabHandle") as Canvas; this.grabHighlightShape = ResourceRoot.FindName("_grabHighlight") as Shape; this.textBlock = ResourceRoot.FindName("_text") as TextBlock; this.faceHighColorGradientStop = ResourceRoot.FindName("_colourRangeStart") as GradientStop; this.faceLowColorGradientStop = ResourceRoot.FindName("_colourRangeEnd") as GradientStop; this.needleHighColorGradientStop = ResourceRoot.FindName("_needleHighColour") as GradientStop; this.needleLowColorGradientStop = ResourceRoot.FindName("_needleLowColour") as GradientStop; }
/// <summary> /// Set our text color to that of the TextColorProperty /// </summary> protected override void UpdateTextColor() { textBlock.Foreground = new SolidColorBrush(ValueTextColor); for (var i = 0; i < 5; i++) { if (ResourceRoot.FindName("_txt" + i) is TextBlock tb) { tb.Foreground = new SolidColorBrush(FaceTextColor); } } }
/// <summary> /// Sets the text visibility to that of the TextVisibility property /// </summary> protected override void UpdateTextVisibility() { textBlock.Visibility = ValueTextVisibility; for (var i = 0; i < 5; i++) { if (ResourceRoot.FindName("_txt" + i) is TextBlock tb) { tb.Visibility = FaceTextVisibility; } } }
/// <summary> /// Set our text color to that of the TextColorProperty /// </summary> protected override void UpdateTextColor() { this.textBlock.Foreground = new SolidColorBrush(ValueTextColor); for (int i = 0; i < 5; i++) { TextBlock tb = ResourceRoot.FindName("_txt" + i) as TextBlock; if (tb != null) { tb.Foreground = new SolidColorBrush(FaceTextColor); } } }
/// <summary> /// Sets the text visibility to that of the TextVisibility property /// </summary> protected override void UpdateTextVisibility() { this.textBlock.Visibility = ValueTextVisibility; for (int i = 0; i < 5; i++) { TextBlock tb = ResourceRoot.FindName("_txt" + i) as TextBlock; if (tb != null) { tb.Visibility = FaceTextVisibility; } } }
/// <summary> /// The format string for the value has changed /// </summary> protected override void UpdateTextFormat() { for (var i = 0; i <= 4; i++) { if (ResourceRoot.FindName("_txt" + i) is TextBlock tb && FaceTextFormat != null) { tb.Text = string.Format(FaceTextFormat, RealMinimum + (i * ((RealMaximum - RealMinimum) / 4))); } } if (textBlock != null) { textBlock.Text = IsGrabbed ? FormattedCurrentValue : FormattedValue; } }
/// <summary> /// The format string for the value has changed /// </summary> protected override void UpdateTextFormat() { for (int i = 0; i <= 4; i++) { TextBlock tb = ResourceRoot.FindName("_txt" + i) as TextBlock; if (tb != null && FaceTextFormat != null) { tb.Text = String.Format(FaceTextFormat, RealMinimum + (i * ((RealMaximum - RealMinimum) / 4))); } } if (this.textBlock != null) { this.textBlock.Text = this.IsGrabbed ? FormattedCurrentValue : FormattedValue; } }