Skip to main content
All docs
V24.2

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

RepositoryItemTokenEdit.RemoveTokenButtonClick Event

Occurs when a user clicks the Remove button in the TokenEdit drop-down menu.

Namespace: DevExpress.XtraEditors.Repository

Assembly: DevExpress.XtraEditors.v24.2.dll

NuGet Package: DevExpress.Win.Navigation

#Declaration

[DXCategory("Events")]
public event EventHandler<RemoveTokenButtonClickEventArgs> RemoveTokenButtonClick

#Event Data

The RemoveTokenButtonClick event's data class is DevExpress.XtraEditors.RemoveTokenButtonClickEventArgs.

#Remarks

If the RepositoryItemTokenEdit.ShowRemoveTokenButtons property is set to true, tokens in the drop-down menu display the Remove button.

Remove button

In unbound mode, set the e.Cancel property to true to keep the token and ignore the user’s click action.

void TokenEdit1_RemoveTokenButtonClick(object sender, RemoveTokenButtonClickEventArgs e) {
    if (e.Text == "admin")
        e.Cancel = true;
}

In unbound mode, the e.Cancel property has no effect because tokens are stored in a data source rather than in the RepositoryItemTokenEdit.Tokens collection. To remove tokens from the drop-down menu, you need to remove them from the data source.

void TokenEdit1_RemoveTokenButtonClick(object sender, RemoveTokenButtonClickEventArgs e) {
    if (e.Text != "admin")
        //use data source API to remove a token
        //read the e.RowObject property to obtain a data source record
}
See Also