Class StateIndicator
Represents the gauge visual element that has the ability to indicate the state of the Gauge, by turning itself "on" when the pointer reaches a stated range and vice versa.
Implements
Inherited Members
Namespace: Syncfusion.Windows.Gauge
Assembly: Syncfusion.Gauge.WPF.dll
Syntax
public class StateIndicator : LocalizableGaugeElement, IDisposable
Remarks
Inorder to make the StateIndicator work property, the StateRange values should be properly initialized and the ActiveBackgroundBrush should be set to a different color other than the range's BackgroundBrush color inorder to make the StateIndicator's state change visible.
Examples
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Media;
using System.Windows.Controls;
using Syncfusion.Windows.Shared;
using Syncfusion.Windows.Gauge;
namespace WpfApplication5
{
public partial class Window1 : Window
{
private CircularScale m_scale;
private StateIndicator m_indicator;
private CircularGauge m_gauge;
public Window1()
{
InitializeComponent();
m_scale = new CircularScale();
m_gauge = new CircularGauge();
m_scale.ShadowOffset = 1;
m_scale.Minimum = 0;
m_scale.Maximum = 100;
m_scale.MinorIntervalValue = 2;
m_scale.MajorIntervalValue = 10;
m_scale.StartAngle = 120;
m_scale.GapSweepAngle = 300;
m_scale.ScaleBarSize = 1.5;
m_scale.Radius = 116;
this.m_gauge.Scales.Add(m_scale);
m_indicator = new StateIndicator();
m_indicator.StateRanges.Add(new StateRange(10, 20));
m_indicator.StateRanges.Add(new StateRange(50, 60));
m_indicator.IndicatorStyle = IndicatorStyle.RoundedRectangularLED;
m_indicator.BackgroundBrush = new RadialGradientBrush(Colors.White,Colors.DarkGreen);
m_indicator.ActiveBackgroundBrush = new RadialGradientBrush(Colors.White, Colors.Red);
m_indicator.IndicatorWidth = 20;
m_indicator.IndicatorHeight = 20;
m_indicator.Location = new Point(50, 80);
m_gauge.StateIndicators.Add(m_indicator);
this.Content = m_gauge;
}
}
}
Constructors
StateIndicator()
Initializes a new instance of the StateIndicator class.
Declaration
public StateIndicator()
Fields
ActiveBackgroundBrushProperty
Identifies the ActiveBackgroundBrush dependency property.
Declaration
public static readonly DependencyProperty ActiveBackgroundBrushProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
ActiveBorderBrushProperty
Identifies the ActiveBorderBrush dependency property.
Declaration
public static readonly DependencyProperty ActiveBorderBrushProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
ActiveTextProperty
Identifies the ActiveText dependency property.
Declaration
public static readonly DependencyProperty ActiveTextProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
FontFamilyProperty
Identifies the FontFamily dependency property.
Declaration
public static readonly DependencyProperty FontFamilyProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
FontSizeProperty
Identifies the FontSize dependency property.
Declaration
public static readonly DependencyProperty FontSizeProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
IndicatorCustomGeometryProperty
Identifies the IndicatorCustomGeometryProperty dependency property.
Declaration
public static readonly DependencyProperty IndicatorCustomGeometryProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
IndicatorHeightProperty
Identifies the IndicatorHeight dependency property.
Declaration
public static readonly DependencyProperty IndicatorHeightProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
IndicatorStyleProperty
Identifies the IndicatorStyle dependency property.
Declaration
public static readonly DependencyProperty IndicatorStyleProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
IndicatorWidthProperty
Identifies the IndicatorWidth dependency property.
Declaration
public static readonly DependencyProperty IndicatorWidthProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
TextProperty
Identifies the Text dependency property.
Declaration
public static readonly DependencyProperty TextProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
ValueProperty
Identifies the Value dependency property.
Declaration
public static readonly DependencyProperty ValueProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
Properties
ActiveBackgroundBrush
Gets or sets the background of the state indicator when it is turned on. This is a dependency property.
Declaration
public Brush ActiveBackgroundBrush { get; set; }
Property Value
Type | Description |
---|---|
System.Windows.Media.Brush | Type: System.Windows.Media.Brush |
ActiveBorderBrush
Gets or sets the border brush of the state indicator when it is turned on. This is a dependency property.
Declaration
public Brush ActiveBorderBrush { get; set; }
Property Value
Type | Description |
---|---|
System.Windows.Media.Brush | Type: System.Windows.Media.Brush |
ActiveText
Gets or sets the text that is displayed in Text mode when the state indicator is turned on. This is a dependency property.
Declaration
public string ActiveText { get; set; }
Property Value
Type | Description |
---|---|
System.String | Type: System.String Default value is string.empty. |
See Also
FontFamily
Gets or sets the font family for the text that is displayed in Text mode. This is a dependency property.
Declaration
public FontFamily FontFamily { get; set; }
Property Value
Type | Description |
---|---|
System.Windows.Media.FontFamily | Type: FontFamily |
FontSize
Gets or sets the font size for the text that is displayed in Text mode. This is a dependency property.
Declaration
public double FontSize { get; set; }
Property Value
Type | Description |
---|---|
System.Double | Type: System.Double Default value is 12. |
IndicatorCustomGeometry
Gets or sets a custom geometry for the State Indicator. This is a dependency property.
Declaration
public Geometry IndicatorCustomGeometry { get; set; }
Property Value
Type | Description |
---|---|
System.Windows.Media.Geometry | Type: System.Windows.Media.Geometry Default value is null. |
IndicatorHeight
Gets or sets the height of the state indicator. This is a dependency property.
Declaration
public double IndicatorHeight { get; set; }
Property Value
Type | Description |
---|---|
System.Double | Type: System.Double Default value is 0. |
IndicatorStyle
Gets or sets the indicator style value. Specifies a different look for the state indicator. This is a dependency property.
Declaration
public IndicatorStyle IndicatorStyle { get; set; }
Property Value
Type | Description |
---|---|
IndicatorStyle | Type: IndicatorStyle Default value is IndicatorStyle.CircularLED. |
IndicatorWidth
Gets or sets the width of the state indicator. This is a dependency property.
Declaration
public double IndicatorWidth { get; set; }
Property Value
Type | Description |
---|---|
System.Double | Type: System.Double Default value is 0. |
StateRanges
Gets the Collection of state ranges used to turn on/off the state indicator.
Declaration
public StateRangeCollection StateRanges { get; set; }
Property Value
Type | Description |
---|---|
StateRangeCollection | Type: StateRangeCollection |
Text
Gets or sets the text that is displayed in Text mode when the state indicator is turned off. This is a dependency property.
Declaration
public string Text { get; set; }
Property Value
Type | Description |
---|---|
System.String | Type: System.String Default value is string.empty. |
See Also
Value
Gets or sets the value of the state indicator. If it falls within one of the state ranges the state indicator turns on. This is a dependency property.
Declaration
public double Value { get; set; }
Property Value
Type | Description |
---|---|
System.Double | Type: System.Double Default value is 0. |
Methods
ArrangeOverride(Size)
Positions child elements and determines a size for the element.
Declaration
protected override Size ArrangeOverride(Size finalSize)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Size | finalSize | The final area within the parent that this element should use to arrange itself and its children. |
Returns
Type | Description |
---|---|
System.Windows.Size | The actual size used. |
Dispose()
Declaration
public void Dispose()
GetActiveStateColor()
This method gets the Activation state Colors of the StateIndicator
Declaration
protected virtual Brush GetActiveStateColor()
Returns
Type |
---|
System.Windows.Media.Brush |
GetIsStateActive()
Gets the value indicating whether the state indicator is turned on.
Declaration
protected virtual bool GetIsStateActive()
Returns
Type | Description |
---|---|
System.Boolean | The value indicating whether the state indicator is turned on. |
MeasureOverride(Size)
Measures the size in layout required for child elements and determines a size for the element.
Declaration
protected override Size MeasureOverride(Size constraint)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Size | constraint | The available size that this element can give to child elements. |
Returns
Type | Description |
---|---|
System.Windows.Size | The size that this element determines it needs during layout. |
OnActiveTextChanged(DependencyPropertyChangedEventArgs)
Updates property value cache and raises ActiveTextChanged event.
Declaration
protected virtual void OnActiveTextChanged(DependencyPropertyChangedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.DependencyPropertyChangedEventArgs | e | Property change details, such as old value and new value. |
OnAngleChanged(DependencyPropertyChangedEventArgs)
Updates property value cache and raises Syncfusion.Windows.Gauge.StateIndicator.AngleChanged event.
Declaration
protected virtual void OnAngleChanged(DependencyPropertyChangedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.DependencyPropertyChangedEventArgs | e | Property change details, such as old value and new value. |
OnIndicatorCustomGeometryChanged(DependencyPropertyChangedEventArgs)
Updates property value cache and raises OnIndicatorCustomGeometryChanged event.
Declaration
protected virtual void OnIndicatorCustomGeometryChanged(DependencyPropertyChangedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.DependencyPropertyChangedEventArgs | e | Property change details, such as old value and new value. |
OnIndicatorStyleChanged(DependencyPropertyChangedEventArgs)
Updates property value cache and raises IndicatorStyleChanged event.
Declaration
protected virtual void OnIndicatorStyleChanged(DependencyPropertyChangedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.DependencyPropertyChangedEventArgs | e | Property change details, such as old value and new value. |
OnInitialized(EventArgs)
Raises the System.Windows.FrameworkElement.Initialized event. This method is invoked whenever System.Windows.FrameworkElement.IsInitialized property is set to true internally.
Declaration
protected override void OnInitialized(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.EventArgs | e | The System.EventArgs that contains the event data. |
OnRender(DrawingContext)
Participates in rendering operations that are directed by the layout system.
Declaration
protected override void OnRender(DrawingContext drawingContext)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Media.DrawingContext | drawingContext | The drawing instructions for a specific element. |
OnStateIndicatorHeightChanged(DependencyPropertyChangedEventArgs)
Updates property value cache and raises StateIndicatorHeightChanged event.
Declaration
protected virtual void OnStateIndicatorHeightChanged(DependencyPropertyChangedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.DependencyPropertyChangedEventArgs | e | Property change details, such as old value and new value. |
OnStateIndicatorWidthChanged(DependencyPropertyChangedEventArgs)
Updates property value cache and raises StateIndicatorWidthChanged event.
Declaration
protected virtual void OnStateIndicatorWidthChanged(DependencyPropertyChangedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.DependencyPropertyChangedEventArgs | e | Property change details, such as old value and new value. |
OnTextChanged(DependencyPropertyChangedEventArgs)
Updates property value cache and raises TextChanged event.
Declaration
protected virtual void OnTextChanged(DependencyPropertyChangedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.DependencyPropertyChangedEventArgs | e | Property change details, such as old value and new value. |
OnValueChanged(DependencyPropertyChangedEventArgs)
Updates property value cache and raises ValueChanged event.
Declaration
protected virtual void OnValueChanged(DependencyPropertyChangedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.DependencyPropertyChangedEventArgs | e | Property change details, such as old value and new value. |
Events
ActiveTextChanged
Event that is raised when ActiveText property is changed.
Declaration
public event PropertyChangedCallback ActiveTextChanged
Event Type
Type |
---|
System.Windows.PropertyChangedCallback |
IndicatorCustomGeometryChanged
Event that is raised when IndicatorCustomGeometry property is changed.
Declaration
public event PropertyChangedCallback IndicatorCustomGeometryChanged
Event Type
Type |
---|
System.Windows.PropertyChangedCallback |
IndicatorStyleChanged
Event that is raised when IndicatorStyle property is changed.
Declaration
public event PropertyChangedCallback IndicatorStyleChanged
Event Type
Type |
---|
System.Windows.PropertyChangedCallback |
StateIndicatorHeightChanged
Event that is raised when IndicatorHeight property is changed.
Declaration
public event PropertyChangedCallback StateIndicatorHeightChanged
Event Type
Type |
---|
System.Windows.PropertyChangedCallback |
StateIndicatorWidthChanged
Event that is raised when IndicatorWidth property is changed.
Declaration
public event PropertyChangedCallback StateIndicatorWidthChanged
Event Type
Type |
---|
System.Windows.PropertyChangedCallback |
TextChanged
Event that is raised when Text property is changed.
Declaration
public event PropertyChangedCallback TextChanged
Event Type
Type |
---|
System.Windows.PropertyChangedCallback |
ValueChanged
Event that is raised when Value property is changed.
Declaration
public event PropertyChangedCallback ValueChanged
Event Type
Type |
---|
System.Windows.PropertyChangedCallback |