Skip to main content

StepProgressBar.SelectedItemChanged Event

Fires when the selection moves to another item.

Namespace: DevExpress.XtraEditors

Assembly: DevExpress.XtraEditors.v24.2.dll

Declaration

[DXCategory("Property Changed")]
public event StepProgressBarSelectedItemChangedEventHandler SelectedItemChanged

Event Data

The SelectedItemChanged event's data class is DevExpress.XtraEditors.StepProgressBarSelectedItemChangedEventArgs.

Remarks

The sample below illustrates how to change item settings when the SelectedItemChanged event occurs.

dynamicSettings

using DevExpress.XtraEditors;

// ...

spBar1.ConnectorLineThickness = 15;
spBar1.IndentBetweenItems = 50;
spBar1.IndicatorLineThickness = 4;
spBar1.ItemOptions.ConnectorOffset = -20;
spBar1.ItemOptions.Indicator.ActiveStateDrawMode = DevExpress.XtraEditors.IndicatorDrawMode.None;
spBar1.ItemOptions.Indicator.InactiveStateDrawMode = DevExpress.XtraEditors.IndicatorDrawMode.None;
spBar1.ItemOptions.Indicator.Width = 50;

void OnSelectedItemChanged(object sender, StepProgressBarSelectedItemChangedEventArgs e) {
    StepProgressBar bar = sender as StepProgressBar;
    foreach (StepProgressBarItem item in bar.Items) {
        item.Options.Indicator.ActiveStateImageOptions.SvgImage = null;
        item.Options.Indicator.Width = 50;
        item.Options.ConnectorOffset = -20;
        item.ContentBlock1.Description = null;
    }

    var currentItem = e.SelectedItems.Last();

    if (currentItem != null) {
        currentItem.Options.Indicator.ActiveStateImageOptions.SvgImage = svgImageCollection1[0];
        currentItem.Options.Indicator.Width = 100;
        currentItem.ContentBlock1.Description = "Step " + (bar.SelectedItemIndex + 1).ToString() + " of 6";
        currentItem.Options.ConnectorOffset = 0;
        if (bar.SelectedItemIndex < 3)
            bar.Appearances.CommonActiveColor = Color.IndianRed;
        if (bar.SelectedItemIndex >= 3 && bar.SelectedItemIndex < 5)
            bar.Appearances.CommonActiveColor = Color.Goldenrod;
        if (bar.SelectedItemIndex >= 5)
            bar.Appearances.CommonActiveColor = Color.Green;
    }
}
See Also