Blazored / Toast

A JavaScript free toast library for Blazor and Razor Component applications
https://blazored.github.io/Toast/
MIT License
663 stars 92 forks source link

[Question] how to close the Toast in the custom component toast #150

Closed silazzz closed 2 years ago

silazzz commented 2 years ago

Hi, My question is how cam i Access the close Function in a custom Toast?

I can Only pass the renderfragment.

thank you

Solution: The Toast pass the toast object as CascadeValue so you can get the toast object : In your custom component: Das [CascadingParamter] private BlazoredToaast Toast {get; set;}

and call Toast.Close()

silazzz commented 2 years ago

Solution: The Toast pass the toast object as CascadeValue so you can get the toast object : In your custom component: Das [CascadingParamter] private BlazoredToaast Toast {get; set;}

and call Toast.Close()