I've got a button in a ribbon I've implemented and having trouble binding to a command. The ribbon is in a UserControl named AppRibbon. The AppRibon control has a public property called SelectedModule which has a property named RenameModuleCmd. When I create an event handler for the button, i call the command explicitly to make sure everything is working as shown below:
public partial class ApplicationRibbon : UserControl {
public ApplicationRibbon() {
InitializeComponent();
}
public ModuleViewModel SelectedModule { get; set; }
private void ButtonTool_Click(object sender, RoutedEventArgs e) {
SelectedModule.RenameModuleCmd.Execute(null);
}
}
This works fine. But I obviously don't want to use the code behind model... much rather use the Command binding. So I tried the folling bindings, but nothing fired the command.
<... Command="{Binding Path=SelectedModule.RenameModuleCmd}" />
<... Command="{Binding Path=AppRibbon.SelectedModule.RenameModuleCmd}" />
I can't figure out why these won't work. I've set breakpoints on the command's CanExecute and Execute methods as well on the RenameModuleCmd property's getter, but none are hit. Ideas?