Drawer Events
This article explains the events available in the Telerik Drawer for Blazor:
SelectedItemChanged
The SelectedItemChanged event fires every time the user clicks on a new item from the Drawer. You can use it with one-way data binding to respond to the user selection. It receives an argument of the Drawer data model type.
Handle SelectedItemChanged event
ExpandedChanged
The ExpandedChanged event fires every time the component's state is changed - to expanded or to collapsed. You can use it with one-way data binding for the Expanded parameter. It takes an argument of the bool type that corresponds to its new state - whether the drawer is expanded.
If you only need conditional markup based on the expanded/collapsed state of the drawer, use two-way binding (
@bind-Expanded) - in this example, hiding the button conditionally can be achieved either way, but two-way binding requires less code.
Handle ExpandedChanged event
The result from the code snippet above
The event is an
EventCallback. It can be synchronous and returnvoid, or asynchronous and returnasync Task. Do not useasync void.
The lambda expression in the handler is required by the framework: https://github.com/aspnet/AspNetCore/issues/12226.
OnItemRender
The OnItemRender event fires when each item in the Drawer renders. It allows you to customize the appearance of an item. Note that the event does not work alongside a <Template>, as the template disables all item related built-in features of the Drawer.
As an argument, the event handler receives an object of type DrawerItemRenderEventArgs that contains the following properties:
| Property | Type | Description |
|---|---|---|
Item | object | The current item that renders in the Drawer. |
Class | string | The custom CSS class that will be added to the item. |
Customizing the appearance of the Drawer items based on the Drawer mode.