I have a slider like so;
<SfSlider ID="SliderTF" Min="0" Max="60" @bind-Value="@graphicsSettings.TargetFrameRate" Type="SliderType.MinRange">
<SliderTicks Placement="Placement.After" Format="N0" ShowSmallTicks="true" LargeStep="6" SmallStep="3"></SliderTicks>
<SliderEvents TValue="int" OnChange="setTargetFrameRate"></SliderEvents>
</SfSlider>
The OnChange method setTargetFrameRate is never reached, but if i change the @bind-value to a local property such as a `private int TargetFrameRate` that is same type as graphicsSettings.TargetFrameRate, it does work. This means i had to make local copies for all the graphics settings properties. When looking at graphicsSettings.TargetFrameRate its values do change when binded to the slider, but it just doesn't seem to call the OnChange event.
I'm wondering if maybe this is because in my object, TargetFrameRate can be null?
If it is needed, the class can just be:
public class GraphicsSettings
{
public int TargetFrameRate { get; set; }
}
Then in class GraphicsSettings graphicsSettings = new GraphicsSettings();
graphicsSettings.TargetFrameRate = 60;
Thank you very much for your help!
I found one minor hiccup however, the OnChange event seemed to call as soon as the value binded by the @bind-value changed. This meant that on the method call, it would have the previous value. If i added a await Task.Delay(1000) it would then have the correct value. But i found the best way was to just use the SliderChangeEventArgs.
And i think the original issue i was having was because my properties were nullable, so after making TValue="int?" the OnChange event worked.
This was what my code ending up looking like: