Hiexperts,
trying to grasp the concepts behind the MVVM pattern, I'm playing around with Josh Smiths MVVM sample application (http://msdn.microsoft.com/en-us/magazine/dd419663.aspx).
The sample app has a HeaderedContentControl where all the commands from the MainWindowViewModels Commands property are displayed. I'm struggling right now with adding some of these commands to the MainWindows header menu. My approach is as follows:
<Menu KeyboardNavigation.TabNavigation="Cycle">
<MenuItem Header="_File">
<MenuItem Header="E_xit" Command="{Binding Path=CloseCommand}" />
</MenuItem>
<MenuItem Header="_View">
<MenuItem Header="View All Customers" Command="{Binding Path=ShowAllCustomer}" />
</MenuItem>
<MenuItem Header="_Edit">
<MenuItem Header="Add New Customer" Command="{Binding Path=CreateNewCustomer}" />
</MenuItem>
<MenuItem Header="_Help" />
</Menu>
The Exit Command is working, but the other two command bindings result in BindingExpression path errors in Immediate Window. Please can anyone point me in the right direction? Errors from output window are:
System.Windows.Data Error: 40 : BindingExpression path error: 'ShowAllCustomer' property not found on 'object' ''MainWindowViewModel' (HashCode=51199880)'. BindingExpression:Path=ShowAllCustomer; DataItem='MainWindowViewModel' (HashCode=51199880); target element is 'MenuItem' (Name=''); target property is 'Command' (type 'ICommand') System.Windows.Data Error: 40 : BindingExpression path error: 'CreateNewCustomer' property not found on 'object' ''MainWindowViewModel' (HashCode=51199880)'. BindingExpression:Path=CreateNewCustomer; DataItem='MainWindowViewModel' (HashCode=51199880); target element is 'MenuItem' (Name=''); target property is 'Command' (type 'ICommand')