I'm creating a Blazor WebAssembly app, I have an enum I'd like to pass as parameter to my Blazor component like this
public enum EMenu
{
Menu1 = 1,
Menu2 = 2,
Menu3 = 3,
}
[Parameter] public EMenu Id { get; set; }
<NavMenu id="menu1" />
The EMenu is my enum, Id is my parameter on my NavMenu component. But it errors out with Specified cast is not valid message.
I googled and saw this GitHub issue https://github.com/dotnet/aspnetcore/issues/19139 and according to it the following should work when you prefix the enum value with your enum name
<NavMenu id="EMenu.Menu1" />
But it did not work for me, same error. Could someone help point out what's wrong?