Validate user action when removing items from RadAutoCompleteBox
Environment
Product Version | Product | Author |
---|---|---|
2021.1.223 | RadAutoCompleteBox for WinForms | Nadya Karaivanova |
Description
A common requirement is to validate the user action when he/she wants to remove a tokenized item from the text box field in RadAutoCompleteBox. This article will demonstrate how you can achieve this by displaying a message box which ensures whether the item should be removed or not.
Solution
This can be achieved with using a custom text block element. First, it is necessary to create a custom class that inherits from the TokenizedTextBlockElement class. Then, override the OnRemoveButtonClick method where the actual removing of items is happening:
Then, you should replace the default item with the newly created custom one in the CreateTextBlock event: