Back to Devexpress

StateIndicatorControl Class

wpf-devexpress-dot-xpf-dot-gauges-1bcdf5cc.md

latest4.7 KB
Original Source

StateIndicatorControl Class

A state indicator control shipped with the DXGauges Suite.

Namespace : DevExpress.Xpf.Gauges

Assembly : DevExpress.Xpf.Gauges.v25.2.dll

NuGet Package : DevExpress.Wpf.Gauges

Declaration

csharp
[DXLicenseWpf]
public class StateIndicatorControl :
    Control,
    IModelSupported,
    ILayoutCalculator
vb
<DXLicenseWpf>
Public Class StateIndicatorControl
    Inherits Control
    Implements IModelSupported,
               ILayoutCalculator

Remarks

Run Demo: State Indicator Models

A state indicator is used to imitate a static device or indicator that has a set of fixed states.

The following images show some examples of a state indicator.

Traffic LightsSmile

A state indicator control is based on a state image element. To learn more about it, refer to the Visual Element (State Indicator) section.

Example

This example demonstrates how to create and customize a StateIndicatorControl.

View Example

csharp
using System.Windows;
using System.Windows.Input;

namespace DXGauges_StateIndicator {

    public partial class MainWindow : Window {
        public MainWindow() {
            InitializeComponent();
        }

        private void stateIndicatorControl1_MouseEnter(object sender, MouseEventArgs e) {
            stateIndicatorControl1.StateIndex = 0;
        }

        private void stateIndicatorControl1_MouseLeave(object sender, MouseEventArgs e) {
            stateIndicatorControl1.StateIndex = 2;
        }

    }
}
xaml
<Window x:Class="DXGauges_StateIndicator.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:dxga="http://schemas.devexpress.com/winfx/2008/xaml/gauges"
        Title="MainWindow" Height="350" Width="525" >
    <Grid>
        <dxga:StateIndicatorControl Name="stateIndicatorControl1" StateIndex="2"
                                    MouseEnter="stateIndicatorControl1_MouseEnter" 
                                    MouseLeave="stateIndicatorControl1_MouseLeave">
            <!--region #Model-->
            <dxga:StateIndicatorControl.Model>
                <dxga:SmileStateIndicatorModel />
            </dxga:StateIndicatorControl.Model>
            <!--endregion #Model-->
        </dxga:StateIndicatorControl>
    </Grid>
</Window>
vb
Imports Microsoft.VisualBasic
Imports System.Windows
Imports System.Windows.Input

Namespace DXGauges_StateIndicator

    Partial Public Class MainWindow
        Inherits Window
        Public Sub New()
            InitializeComponent()
        End Sub

        Private Sub stateIndicatorControl1_MouseEnter(ByVal sender As Object, ByVal e As MouseEventArgs)
            stateIndicatorControl1.StateIndex = 0
        End Sub

        Private Sub stateIndicatorControl1_MouseLeave(ByVal sender As Object, ByVal e As MouseEventArgs)
            stateIndicatorControl1.StateIndex = 2
        End Sub

    End Class
End Namespace

Inheritance

Object DispatcherObject DependencyObject Visual UIElement FrameworkElement Control StateIndicatorControl

See Also

StateIndicatorControl Members

DevExpress.Xpf.Gauges Namespace