Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

How to inherite from MudDebouncedInput and overwrite DebounceInterval

$
0
0

I'm using Blazor with MudBlazor.

I'm using the MudTextField very often and have also some validations in some places.Now i would like to create a new component which inherits from the MudTextField component.

My component should only overwrite the DebounceInterval because i want the inputs with validation to trigger it after 300ms (And i don't want to write it every time).The rest of the component should be the same.

I already managed to create a component which renders the same way as the MudTextField but i was not able to overwrite the DebounceInterval because MudBlazor is using ParameterStates (https://mudblazor.com/features/parameterstate#parameter-best-practices). Also for the DebounceInterval there is a state and it is not settable in an inherited class because the state itself is private.

I'm also not able to set the DebounceInterval property directly. It gets ignored because in the base class only the state is used. MudBlazor anyway says that the parameter should be only set through the state.

The only solution that i am currently seeing is that i do not inherit from MudTextField but embed it in my component which is a bad way to do such a small thing.

Here my component:

@inherits MudTextField<T>@typeparam T@{    base.BuildRenderTree(__builder);}@code{    protected override void OnParametersSet()    {        base.OnParametersSet();        DebounceInterval = 300;    }}

Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>