windowsforms-devexpress-dot-xtraeditors-dot-stepprogressbar-4cf41bb3.md
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
[DXCategory("Action")]
public event EventHandler<StepProgressBarItemClickEventArgs> ItemClick
<DXCategory("Action")>
Public Event ItemClick As EventHandler(Of StepProgressBarItemClickEventArgs)
The ItemClick event's data class is StepProgressBarItemClickEventArgs. The following properties provide information specific to this event:
| Property | Description |
|---|---|
| Handled | Gets 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. |
| IsMouseClick | Gets whether the StepProgressBarItem was clicked with the mouse. |
| Item | Gets the clicked StepProgressBarItem. |
| MouseClickArgs | Gets an object that contains mouse click event arguments. |
If the StepProgressBar.AllowUserInteraction property is enabled, a user can interact with StepProgressBar items as follows:
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):
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;
}
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