Back to Devexpress

StateIndicatorControl.StateIndex Property

wpf-devexpress-dot-xpf-dot-gauges-dot-stateindicatorcontrol-fdc15d04.md

latest3.6 KB
Original Source

StateIndicatorControl.StateIndex Property

Gets or sets the index of a state image that is currently displayed on the StateIndicatorControl.

Namespace : DevExpress.Xpf.Gauges

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

NuGet Package : DevExpress.Wpf.Gauges

Declaration

csharp
public int StateIndex { get; set; }
vb
Public Property StateIndex As Integer

Property Value

TypeDescription
Int32

An integer value that is the current state index.

|

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

See Also

StateIndicatorControl Class

StateIndicatorControl Members

DevExpress.Xpf.Gauges Namespace