Handling Users Input
RadToastNotificationManager offers the static RadToastOnActivated event which is fired when the user interacts with the notification and activates it, e.g. after clicking a button. The RadToastOnActivatedEventArgs gives you the following arguments:
- Arguments - arguments passed to the toast.
-
UserInput - returns a Dictionary
containing the user's input.
[Obsolete as of R3 2021 SP 1] RadToastActivated event is not fired on the main UI thread. Hence, you should be cautious when interacting with the controls on the form. Note that all UI controls are not thread safe controls in the whole Windows Forms platform (not just Telerik controls, but all controls out there). You should use Invoke to update the controls in cross threading scenario.
We will extend the example for building log-in toast notification in the Adding Toast Notifications Programmatically article and check the user name and password.
Toast notifications remains in the Windows Action Center until removed and the user can interact with them, even if the application is already closed. Thus, they provide the ability to respond after the application has been closed. The following code snippet demonstrates a sample approach how to detect when a toast has been clicked in this case:
In order to detect when a toast notification is clicked after the application has been closed, do not unregister the manager.