Back to Devexpress

StepProgressBar.ItemClick Event

windowsforms-devexpress-dot-xtraeditors-dot-stepprogressbar-4cf41bb3.md

latest4.3 KB
Original Source

StepProgressBar.ItemClick Event

Occurs when a user clicks an item in the StepProgressBar and allows you to cancel selection.

Namespace : DevExpress.XtraEditors

Assembly : DevExpress.XtraEditors.v25.2.dll

NuGet Package : DevExpress.Win.Navigation

Declaration

csharp
[DXCategory("Action")]
public event EventHandler<StepProgressBarItemClickEventArgs> ItemClick
vb
<DXCategory("Action")>
Public Event ItemClick As EventHandler(Of StepProgressBarItemClickEventArgs)

Event Data

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

PropertyDescription
HandledGets or sets a value that indicates whether the event handler has completely handled the event or whether the system should continue its own processing. Inherited from HandledEventArgs.
IsMouseClickGets whether the StepProgressBarItem was clicked with the mouse.
ItemGets the clicked StepProgressBarItem.
MouseClickArgsGets an object that contains mouse click event arguments.

Remarks

If the StepProgressBar.AllowUserInteraction property is enabled, a user can interact with StepProgressBar items as follows:

  • Click items using the mouse to select them.
  • Navigate between items using the keyboard and press Enter or Space to click an item.

Use the e.Item event parameter to identify the ‘clicked’ step item. Set the e.Handled event parameter to true to cancel selection.

The following code snippet handles the ItemClick event to prompt the user to save changes. If the user chooses to save, the selected item remains unchanged (the operation is canceled):

csharp
stepProgressBar1.AllowUserInteraction = true;
// ...
private void StepProgressBar1_ItemClick(object sender, StepProgressBarItemClickEventArgs e) {
    if (IsDataSaved(e.Item)) return;
    if (XtraMessageBox.Show("You have unsaved changes. Would you like to save them?", "Warning", MessageBoxButtons.YesNo) == DialogResult.Yes)
        e.Handled = true;
}
vb
stepProgressBar1.AllowUserInteraction = True
' ...
Private Sub StepProgressBar1_ItemClick(ByVal sender As Object, ByVal e As StepProgressBarItemClickEventArgs)
    If IsDataSaved(e.Item) Then
        Return
    End If
    If XtraMessageBox.Show("You have unsaved changes. Would you like to save them?", "Warning", MessageBoxButtons.YesNo) = DialogResult.Yes Then
        e.Handled = True
    End If
End Sub

The following animation shows the result:

See Also

AllowUserInteraction

StepProgressBar Class

StepProgressBar Members

DevExpress.XtraEditors Namespace