Part of this question has been answered on how to bind to an enum as a command parameter, but I need to go one step further.
I have a data template that links to a menu and each menu option initiates a command with a different value of the enum. How do I do this? Do I need to resort to just passing a string?
public enum TestEnum
{
First,
Second,
Third
}
<DataTemplate>
<MenuItem Header="{Binding Path=.}" Command="{Binding ACommand}"
CommandParameter="{Binding Path=???}" />
</DataTemplate>
I want the first MenuItem to bind to Enum.First, the second one to Enum.Second, and so on. I want this written, so that I only have to write the data template above once within a Menu instead of a menu item for each enum.value. HTH.
I need the command parameter to be different for each menu item. So I will have 3 menu items of first, second, and third.