All docs
V20.1
20.1
19.2
The page you are viewing does not exist in version 19.2. This link will take you to the root page.
19.1
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.

StepProgressBar Class

Visualizes a linear process and highlights its current stage.

Namespace: DevExpress.XtraEditors

Assembly: DevExpress.XtraEditors.v20.1.dll

Declaration

public class StepProgressBar :
    BaseStyleControl,
    IDirectXClient,
    IStepProgressBarDirectXOwner,
    ISupportXtraAnimation,
    ISupportInitialize,
    IStepProgressBarAppearanceOwner,
    ITouchScrollBarOwner,
    IMouseWheelSupport,
    IStepProgressBarItemOptionsOwner,
    IImageListOwner
Public Class StepProgressBar
    Inherits BaseStyleControl
    Implements IDirectXClient,
               IStepProgressBarDirectXOwner,
               ISupportXtraAnimation,
               ISupportInitialize,
               IStepProgressBarAppearanceOwner,
               ITouchScrollBarOwner,
               IMouseWheelSupport,
               IStepProgressBarItemOptionsOwner,
               IImageListOwner

Remarks

Step Progress Bar is a sequence of connected items. Each item has two states (active and inactive) with different appearance settings.

overview

The control supports both vertical and horizontal orientations. A horizontal Step Progress Bar arranges its items from left to right, vertical - from top to bottom. Enable the InversedProgressDirection property to flip the orientation.

Step Progress Bar items are objects of the StepProgressBarItem class stored in the StepProgressBar.Items collection. Each item has an indicator (central circle) and two identical content blocks.

Item Indicator

An indicator consists of an outline (1), a central area that can be filled with the outline color (2), and an optional image in the middle (3).

indicator

1. Outline settings

  • StepProgressBar.IndicatorLineThickness - specifies line thickness.

  • StepProgressBar.Appearances.CommonActiveColor and StepProgressBar.Appearances.CommonInactiveColor - specify active/inactive outline state colors for all items owned by the control. These settings also affect connectors (lines that link neighboring items).

  • StepProgressBarItem.Appearance.ActiveIndicatorColor and StepProgressBarItem.Appearance.InactiveIndicatorColor - allow you to override common active/inactive state colors for individual items.

  • StepProgressBarIndicatorOptions.Width - the outline diameter. You can access this setting at two levels:

  • use StepProgressBar.ItemOptions.Indicator.Width to change the indicator size for all Progress Bar Items;
  • use StepProgressBarItem.Options.Indicator.Width to set up individual item width.
stepProgressBar1.ItemOptions.Indicator.Width = 50;
stepProgressBarItem1.Options.Indicator.Width = 70;

2. Central area settings

3. Image settings

Use ActiveStateImageOptions and InactiveStateImageOptions properties to assign vector or raster images for active and inactive item states. These properties are accessible at two levels:

  • StepProgressBar.ItemOptions.Indicator. - allows you to assign two global images: an image used by all inactive items, and an image all active items display.

  • StepProgressBarItem.Options.Indicator. - allows you to override global active/inactive state images for individual items.

stepProgressBar1.ItemOptions.Indicator.ActiveStateImageOptions.SvgImage = svgImageCollection1[0];
stepProgressBarItem1.Options.Indicator.ActiveStateImageOptions.SvgImage = svgImageCollection[1];

Indicator Draw Modes

Our StepProgressBarIndicatorOptions.ActiveStateDrawMode and StepProgressBarIndicatorOptions.InactiveStateDrawMode properties allow you to choose from the following indicator styles:

drawmodes

  • Full or Default - an indicator outline is visible and the central indicator area is filled with the outline color.
  • Outline - an indicator outline is visible and the central indicator area is empty.
  • None - neither indicator outline nor central area are visible. If assigned, an indicator icon is the only element visible in this mode.

Similar to other indicator options, you can access these settings at both control and individual items' levels.

stepProgressBar1.ItemOptions.Indicator.ActiveStateDrawMode = IndicatorDrawMode.Full;
stepProgressBarItem1.Options.Indicator.ActiveStateDrawMode = IndicatorDrawMode.Outline;

Content Blocks

Content blocks are objects of the StepProgressBarItemContentBlock class displayed on both sides of indicators.

Orientation

Content blocks can display:

content-block-elements

To access these settings, use StepProgressBarItem.ContentBlock1 and StepProgressBarItem.ContentBlock2 properties.

stepProgressBarItem.ContentBlock1.Caption = "Set up notifications";
stepProgressBarItem.ContentBlock2.Description = "Done";

To change the content block spacing, use StepProgressBar.DistanceBetweenContentBlockElements (1) and StepProgressBar.IndicatorToContentBlockDistance (2) properties.

spacing

The control provides multiple options to change caption and description fonts and colors.

  • Specify caption and description settings for all control items. (Active and inactive states have identical appearances.)
stepProgressBar1.Appearances.FirstContentBlockAppearance.Caption.ForeColor = Color.FromArgb(40, 40, 40);
stepProgressBar1.Appearances.SecondContentBlockAppearance.Description.ForeColor = Color.FromArgb(80, 80, 80);
  • Specify caption and description settings for each item state separately. (Affects all control items.)
stepProgressBar1.Appearances.FirstContentBlockAppearance.CaptionActive.ForeColor = Color.FromArgb(40, 40, 40);
stepProgressBar1.Appearances.FirstContentBlockAppearance.CaptionInactive.ForeColor = Color.Gray;
stepProgressBar1.Appearances.SecondContentBlockAppearance.DescriptionActive.ForeColor = Color.DimGray;
stepProgressBar1.Appearances.SecondContentBlockAppearance.DescriptionInactive.ForeColor = Color.LightGray;
  • Set up caption and description appearances for all items states. (Affects both content blocks within a specific item.)
stepProgressBarItem1.Appearance.ContentBlockAppearance.Caption.ForeColor = Color.FromArgb(40, 40, 40);
stepProgressBarItem1.Appearance.ContentBlockAppearance.Description.ForeColor = Color.Gray;
  • Set up different caption and description appearances for active and inactive item states. (Affects both content blocks within a specific item.)
stepProgressBarItem1.Appearance.ContentBlockAppearance.CaptionActive.ForeColor = Color.FromArgb(40, 40, 40);
stepProgressBarItem1.Appearance.ContentBlockAppearance.CaptionInactive.ForeColor = Color.Gray;
stepProgressBarItem1.Appearance.ContentBlockAppearance.DescriptionActive.ForeColor = Color.DimGray;
stepProgressBarItem1.Appearance.ContentBlockAppearance.DescriptionInactive.ForeColor = Color.LightGray;
  • Specify item state appearance settings for an individual content block.
stepProgressBarItem1.ContentBlock1.Appearance.Caption.ForeColor = Color.FromArgb(40, 40, 40);
stepProgressBarItem1.ContentBlock2.Appearance.Description.ForeColor = Color.FromArgb(60, 60, 60);
  • Specify separate active/inactive item state appearances for a specific content block.
stepProgressBarItem1.ContentBlock1.Appearance.CaptionActive.ForeColor = Color.FromArgb(40, 40, 40);
stepProgressBarItem1.ContentBlock1.Appearance.CaptionInactive.ForeColor = Color.FromArgb(60, 60, 60);
stepProgressBarItem1.ContentBlock1.Appearance.DescriptionActive.ForeColor = Color.Gray;
stepProgressBarItem1.ContentBlock1.Appearance.DescriptionInactive.ForeColor = Color.LightGray;

Connectors

Connectors are lines that link neighboring items. See the following list of main connector settings:

indent

  • Gap between connector and indicator - the ConnectorOffset property, available at both control (StepProgressBar.ItemOptions.ConnectorOffset) and item (StepProgressBarItem.Options.ConnectorOffset) levels.

offset

Layout Modes

The LayoutMode property specifies how the control distributes its items across the client area.

Compact (Default) Layout Mode

If the control has more space than required, the distance between items equals the IndentBetweenItems property value. Items are placed according to the StepProgressBar.ContentAlignment property.

CompactModeLarge

When a control's size is reduced, connectors shorten and content blocks are clipped. No scroll bar is available.

CompactModeSmall

Fixed Layout Mode

In this mode, the distance between items is always equal to the IndentBetweenItems property value.

FixedModeLarge

Items and connectors remain when a control's size is reduced. If there is not enough space to show all items, a scroll bar appears. Use the StepProgressBar.ScrollMode to select the scrollbar style.

FixedModeSmall

FullSize Layout Mode

In "FullSize" mode, the control aligns its first item to the left edge, last item to the right edge, and evenly distributes remaining items.

FullSizeLarge

A similar alignment pattern applies when a control cannot display all of its items. Connectors shorten, content blocks are clipped, and a scroll bar is not displayed.

FullSizeSmall

Select Items

When you select an item, the control selects all previous items. To select items, use any of the following API.

Select a specific item

Deactivate all items

Select (activate) all items

Activate the next or previous item

When a selection moves to another item, the StepProgressBar.SelectedItemChanged event is raised. The sample below illustrates how to use this event to dynamically change item and connector settings.

dynamicSettings

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;

private void spBar1_SelectedItemChanged(object sender, StepProgressBarSelectedItemChangedEventArgs e) {
    DevExpress.XtraEditors.StepProgressBar bar = sender as DevExpress.XtraEditors.StepProgressBar;
    foreach (StepProgressBarItem item in bar.Items) {
        item.Options.Indicator.Images.ActiveStateImageOptions.SvgImage = null;
        item.Options.Indicator.Width = 50;
        item.Options.ConnectorOffset = -20;
        item.ContentBlock1.Description = null;
    }
    if (e.Item != null) {
        e.Item.Options.Indicator.Images.ActiveStateImageOptions.SvgImage = svgImageCollection1[0];
        e.Item.Options.Indicator.Width = 100;
        e.Item.ContentBlock1.Description = "Step " + (bar.SelectedItemIndex + 1).ToString() + " of 6";
        e.Item.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