Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Telerik UI for Blazor Drop Down Enum
<TelerikDropDownList Data="@ModeList" TextField="Text" ValueField="Value" bind-Value="@selectedValue">
</TelerikDropDownList>
<span>Selected: @((Modes)selectedValue)</span>
@functions {
int selectedValue { get; set; } = 0;
public class ModeViewModel
{
public int Value { get; set; }
public string Text { get; set; }
}
IEnumerable<ModeViewModel> ModeList = Enum.GetValues(typeof(Modes))
.Cast<Modes>()
.Select(m => new ModeViewModel { Text = m.ToString(), Value = (int)m });
public enum Modes
{
Play = 0,
Stop = 1,
FastForward = 2,
Rewind = 3
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.