Telerik Forums
UI for Blazor Forum
1 answer
989 views

 

In the main MS Blazor docs there is an article Avoid rerendering after handling events without state changes

They give an example of using a button click - eg

<button @onclick="EventUtil.AsNonRenderingEventHandler<MouseEventArgs>(HandleClick3)">
    Select me (Avoids Rerender and uses <code>MouseEventArgs</code>)
</button>

private void HandleClick3(MouseEventArgs args)
{
    dt = DateTime.Now;

    Logger.LogInformation(
        "This event handler doesn't trigger a rerender. " +
        "Mouse coordinates: {ScreenX}:{ScreenY}", 
        args.ScreenX, args.ScreenY);
}

How can this be applied to say the TelerikNumericTextBox ValueChanged event?

For example, the following gives errors

<TelerikNumericTextBox T="int" Value="@NumericTextBoxValue"

ValueChanged="EventUtil.AsNonRenderingEventHandler<int>(NumericTextBoxChangeHandler)"

Min="1" Max="120" Width="120px">

</TelerikNumericTextBox> private void NumericTextBoxChangeHandler(int newValue) { Console.WriteLine($"newValue == {newValue}"); NumericTextBoxValue = newValue; }

 

Is this possible in Telerik Blazor? Or is there another inbuilt mechanism to control which events automatically invokes StateHasChanged?

Nadezhda Tacheva
Telerik team
 answered on 24 Feb 2022
1 answer
1.1K+ views

I switched Telerik to the Bootstrap theme, which at first looked good, but realized all the Telerik controls don't really seem to be using Bootstrap and are set to the default sizes. I need the small (sm) sizes which in Bootstrap is trivial to change.

Is there a better way to make all the controls smaller? I've found some controls will accept Bootstrap css while others will not making using Telerik time consuming. The best way I've found to make the Grid smaller is to make my own CSS classes and extensive use of the !important tag, but I still have a lot of work left to get the Grid sized appropriately.

Other controls are inconsistent.

For example, this works:
<TelerikTextBox ... Class="form-control form-control-sm" />


But this does not:
<TelerikNumericTextBox ... Class="form-control form-control-sm" />

Dimo
Telerik team
 answered on 14 May 2021
Top users last month
Mark
Top achievements
Rank 1
Yurii
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Hon
Top achievements
Rank 1
Iron
Deltaohm
Top achievements
Rank 3
Bronze
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?