I have Menu in my app. I\'m visualizing it using hierarchical data template:
Seems like I've found solution for part of my problem. Command is not being binding because, it seems like we need to create particular instance of command for each menu item. The core problem is that, allmost all my menuitems execute the same command and differences are only in value of command parameter. So I should do so:
sample menuitem class:
public class RMyMenuItem
{
public string Name { get; set; }
public string InputGesture { get; set; }
public ICommand ItemCommand
{ get; set; }
public List ChildrenItems { get; set; }
}
property in ViewModel:
public ObservableCollection ApplicationMenu
{
get
{
//RApplicationMainMenu menu = new RApplicationMainMenu(0);
//return new ObservableCollection(menu.Items);
return new ObservableCollection()
{
new RMyMenuItem()
{
Name = "item1",
ItemCommand = new DelegateCommand((param) => RunOperationExecute(param)),
ChildrenItems = new List()
{
new RMyMenuItem()
{
Name = "item2",
ItemCommand = new DelegateCommand((param) => RunOperationExecute(param))
}
}
}
};
}
And XAML:
}