Hi, two questions in one.
First, I have a menu where I wish to identify the currently selected menu item by say tagging it with a check mark. I have tried to do this by setting the Icon property to a variable and then setting the Icon string in code:
What I want:
My attempt to replicate:
@code {
private string magicWord = "blobby";
public string ColorcurveIcon = "";
public string ColoroidIcon = "";
private void MenuHandler(MenuItemEventArgs e)
{
ColorcurveIcon = "";
ColoroidIcon = "";
if (e.Text == "Colorcurve")
{
ColorcurveIcon = "check_circle";
magicWord = e.Text + @"_plus";
}
if (e.Text == "Coloroid")
{
ColoroidIcon = "check_circle";
magicWord = e.Text + @"_plus";
}
else
{
magicWord = e.Text + @"_minus";
}
}
}
But this doesn't work. Any way of achieving this end?
Secondly, my menu structure has a lot of menu items. Using the Text property to string compare to identify the selected menu item is laborious, is there a better way to this via, say, a menu index?
Thanks