Introducing custom events
In this recipe, we explore the possibility of enriching our Blazor application with custom events, diving into slightly more advanced territory where JavaScript interplays with Blazor. Alongside custom events, the concept of custom event arguments arises, allowing for the passage of tailored data that goes beyond the standard event payloads. Custom events and their corresponding arguments become invaluable when predefined events fall short, offering the flexibility to capture and respond to specific user actions or external system triggers with precision.
Let’s implement a component that overwrites the data that a user tries to copy from the area that this component protects.
Getting ready
Before we explore the implementation of custom events, do the following:
- Create a
Chapter03
/Recipe06
directory – this will be your working directory - Copy
TicketManager
andTicketOptions
from the Controlling event propagation recipe or from...