DropDownDataGrid Clear Function

Is there any way to specify the function that runs when a use clicks the x presented by the AllowClear property? I am receiving errors on this due to having several dropdowns working in tandem with one another and would love to provide a function that runs on clear.

The clear button will set the value to default(TValue) - if you bind the Value using @bind-Value you can catch this in the property setter.

1 Like

That makes sense, so in my case I had a reference type of IEnumerable, which the default would be null for then. So, the solution here would be to add backing fields for my properties and implement the setters as:

_backingField = value is null ? Enumerable.Empty<T>() : value;

Appreciate the insight on how the clear button functions!

Might be a bit cleaner if the drop down controls had a property to override the default of default(TValue) such as


Which would avoid having to add backing fields for the bind-Value properties in cases like these. Just a thought.