Is there a way to check if EventCallback
has been set to something. I am setting mine outside the component and only want to show certain things inside the component if the EventCallback
has been set.
You can use the HasDelegate property on the EventCallback parameter. This will return a bool indicating whether the event dispatcher is non null
[Parameter]
public EventCallback DoSomething { get; set; }
private bool IsEventSet => DoSomething.HasDelegate;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With