Stepper
Wisej.NET 4.2.0+
The Stepper control displays the steps of a process as a row (or a column) of markers joined by connectors, each with a title and an optional description. Use it as the header of a wizard, to show where a multi-page form is, or as a read-only tracker of a process such as an order or an onboarding.
The stepper shows the steps and handles navigation between them; it does not host the pages. Pair it with a TabControl with hidden tabs, or with panels you show and hide, and switch the page in the ActiveIndexChanged handler.
For a complete list of properties, methods, and events, see the API documentation.
Features
Steps and States
The Steps collection holds Step objects with a Text, a Description, an Icon, a State, and an Optional flag. State is one of Pending (the default), Active, Completed, Error, or Skipped, and decides the colour and glyph of the marker: a check mark for completed steps, an exclamation mark for errors, a dash for skipped steps. Steps notify the control when they change, so setting State on a step updates the browser.
ActiveIndex selects the current step, or -1 for none. The selection is drawn as active without overwriting the stored State of the step, so a step that had an error still has it when the user returns.
Appearance and Orientation
Appearance selects how the markers are drawn: Numbers (numbered circles, the default), Dots (compact circles), or Bars (accent bars above the text). Orientation arranges the steps horizontally (the default) or vertically, which suits a side panel. Setting Icon on a step replaces its marker text with an image.
Navigation
Next() and Previous() move the selection and return true when it changed. Next() marks the step it leaves as Completed when it was Pending or Active; Error and Skipped states are kept. With AllowStepClick set to true, the user can also click a step header, or activate it with the keyboard.
When Linear is true (the default), the user cannot jump forward past a required step that is neither completed nor skipped. Mark a step as Optional to let linear navigation pass it. Assigning ActiveIndex directly bypasses both Linear and validation; use it to restore a saved position.
Validation
Every navigation through Next(), Previous(), or a step click raises Validating first. StepCancelEventArgs carries the current Step, its Index, and the proposed TargetIndex; set Cancel to true to stay on the current step. This event hides the inherited Control.Validating and is independent of focus validation.
Localized Texts
The state names are read to screen readers. PendingText, ActiveText, CompletedText, ErrorText, SkippedText and OptionalText override the built-in translations for the current UI culture.
How To
Build a Checkout Wizard
this.stepper1.Appearance = StepperAppearance.Numbers;
this.stepper1.AllowStepClick = true;
this.stepper1.Steps.Add(new Step { Text = "Cart", Description = "3 items" });
this.stepper1.Steps.Add(new Step { Text = "Shipping", Description = "Address and carrier" });
this.stepper1.Steps.Add(new Step { Text = "Gift wrap", Optional = true });
this.stepper1.Steps.Add(new Step { Text = "Payment", Description = "Card or invoice" });
this.stepper1.Steps.Add(new Step { Text = "Review", Description = "Confirm the order" });
this.stepper1.ActiveIndex = 0;
private void buttonNext_Click(object sender, EventArgs e) => this.stepper1.Next();
private void buttonBack_Click(object sender, EventArgs e) => this.stepper1.Previous();
private void stepper1_ActiveIndexChanged(object sender, EventArgs e)
{
this.tabControl1.SelectedIndex = this.stepper1.ActiveIndex;
}
Block Navigation Until a Page Is Valid
private void stepper1_Validating(object sender, StepCancelEventArgs e)
{
// Going back is always allowed.
if (e.TargetIndex < e.Index)
return;
if (e.Index == 1 && String.IsNullOrWhiteSpace(this.textBoxPostalCode.Text))
{
e.Step.State = StepState.Error;
e.Cancel = true;
return;
}
if (e.Step.State == StepState.Error)
e.Step.State = StepState.Active;
}
Track a Process Without Navigation
Leave AllowStepClick set to false and drive the states from your data to use the stepper as a read-only progress tracker.
this.stepper1.Appearance = StepperAppearance.Bars;
this.stepper1.Steps.Add(new Step { Text = "Received", State = StepState.Completed });
this.stepper1.Steps.Add(new Step { Text = "Picked", State = StepState.Completed });
this.stepper1.Steps.Add(new Step { Text = "Packed", State = StepState.Active });
this.stepper1.Steps.Add(new Step { Text = "Shipped" });
Advanced
JavaScript Widget
| Item | Description |
|---|---|
| Class name | "wisej.web.Stepper" |
| Theme appearance | "stepper"; each step is a "wisej.web.stepper.Item" with the appearance "stepper-item" and the components "header", "marker", "title", "description", "connector" and "bar", which take the states "pending", "active", "completed", "error" and "skipped". See Themes. |