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.1.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.
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
}