Skip to main content
A newer version of this page is available. .

RangeBase.IndicatorLeave Event

Occurs when any value indicator leaves the current range.

Namespace: DevExpress.Xpf.Gauges

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

Declaration

public event IndicatorLeaveEventHandler IndicatorLeave

Event Data

The IndicatorLeave event's data class is IndicatorLeaveEventArgs. The following properties provide information specific to this event:

Property Description
Indicator Gets the object, for which either the RangeBase.IndicatorEnter or RangeBase.IndicatorLeave event has been raised. Inherited from IndicatorEnterLeaveEventArgs.
NewValue Gets the new value of a property. Inherited from ValueChangedEventArgs.
OldValue Gets the old value of a property. Inherited from ValueChangedEventArgs.

Remarks

The IndicatorLeave event occurs if a value indicator that previously entered the current range (for which the RangeBase.IndicatorEnter event was raised) now gets its ValueIndicatorBase.Value property less than the RangeBase.StartValue or greater than or equal to the RangeBase.EndValue properties of the current range. Note that the IndicatorLeave event is invoked irrespective of the way an indicator’s value was changed - either via mouse-click on a range or programmatically via code.

The RangeBase.IndicatorEnter and IndicatorLeave events can be used together for various purposes (e.g. to create a state indicator).

Example

In some cases, you need to know whether the current value of an indicator is within a particular range. This example shows how to create a state indicator that changes its color depending on the current range.

First, the Circular gauge is created with three ranges and two empty sections. By default, the gauge’s needle doesn’t belong to any range, so the state indicator is painted as a gray ellipse.

To solve this task it’s necessary to handle the RangeBase.IndicatorEnter and RangeBase.IndicatorLeave events in the following way:

- if a needle ‘enters’ a range, it is painted with the range color;

- if a needle ‘leaves’ a range, it is painted in gray.

Note

In this example we set the ValueIndicatorBase.IsInteractive property to True, so that you can click on a gauge and manually change the current needle value.

Imports Microsoft.VisualBasic
Imports System.Windows
Imports System.Windows.Media
Imports DevExpress.Xpf.Gauges

Namespace DXGauges_RangeEvents

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

        Private Sub GreenRange_IndicatorEnter(ByVal sender As Object, ByVal e As IndicatorEnterEventArgs)
            stateIndicator.Fill = New SolidColorBrush(Colors.Green)
        End Sub

        Private Sub GreenRange_IndicatorLeave(ByVal sender As Object, ByVal e As IndicatorLeaveEventArgs)
            stateIndicator.Fill = New SolidColorBrush(Colors.Gray)
        End Sub

        Private Sub YellowRange_IndicatorEnter(ByVal sender As Object, ByVal e As IndicatorEnterEventArgs)
            stateIndicator.Fill = New SolidColorBrush(Colors.Yellow)
        End Sub

        Private Sub YellowRange_IndicatorLeave(ByVal sender As Object, ByVal e As IndicatorLeaveEventArgs)
            If ((e.NewValue) < 10) OrElse (((e.NewValue) > 90)) Then
                stateIndicator.Fill = New SolidColorBrush(Colors.Gray)
            End If
        End Sub

        Private Sub RedRange_IndicatorEnter(ByVal sender As Object, ByVal e As IndicatorEnterEventArgs)
            stateIndicator.Fill = New SolidColorBrush(Colors.Red)
        End Sub

        Private Sub RedRange_IndicatorLeave(ByVal sender As Object, ByVal e As IndicatorLeaveEventArgs)
            If ((e.NewValue) < 10) OrElse (((e.NewValue) > 90)) Then
                stateIndicator.Fill = New SolidColorBrush(Colors.Gray)
            End If
        End Sub
    End Class
End Namespace

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the IndicatorLeave event.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also