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

Which event in a MudBlazor MudSelect is called when selection is changed and how would it be implemented?

$
0
0

I'm using MudBlazor and implemented a MudSelect component following the documentation.

However, I'm trying to get the selected value from the MudSelect when a selection has been made but unsure which event to call. Tried a few such as SelectedValuesChanged but nothing is firing in my code block when the selection has been updated.

Using a standard HTML select I would just call @onchange and then write a method for the event. This doesn't work in MudBlazor.

Here is my MudSelect

<MudSelect T="Stage" Label="Stage" Variant="Variant.Filled" AnchorOrigin="Origin.BottomCenter"><MudSelectItem Value="@(new Stage("Stage 1"))" /><MudSelectItem Value="@(new Stage("Stage 2"))" /><MudSelectItem Value="@(new Stage("Stage 3"))" /><MudSelectItem Value="@(new Stage("Stage 4"))" /><MudSelectItem Value="@(new Stage("Stage 5"))" /></MudSelect>

Here's the @code block

public class Stage{    public Stage(string stageName)    {        StageName = stageName;    }    public readonly string StageName;    public override bool Equals(object o)    {        var other = o as Stage;        return other?.StageName == StageName;    }    public override int GetHashCode() => StageName?.GetHashCode() ?? 0;    public override string ToString() => StageName;}

Viewing all articles
Browse latest Browse all 4839

Trending Articles



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