Created
May 21, 2019 16:09
-
-
Save EdCharbeneau/137004e262e41e8efebcb29875646583 to your computer and use it in GitHub Desktop.
Telerik UI for Blazor Drop Down Enum
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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