Page not able to bind to RibbonCommand?

Nov 19, 2008 at 11:56 PM
Edited Nov 19, 2008 at 11:57 PM
I can't figure out how to get a Page (in a Frame) to bind to a RibbonCommand.  I put this code in the Loaded event handler of my Page



.CommandBindings.Add(new CommandBinding(AppCommands.Save, new ExecutedRoutedEventHandler(this.OnSave)));

but the RibbonButton with the command AppCommands.Save is still disabled.  I then put this code in the Loaded event handler instead (this.hostWindow is a reference to the main window)



this.hostWindow.CommandBindings.Add(new CommandBinding(AppCommands.Save, new ExecutedRoutedEventHandler(this.OnSave)));

and then the RibbonButton is enabled.

What am I missing?




Nov 20, 2008 at 5:19 AM
This is probably the same issue I am running into.  Try setting FocusManager.IsFocusScope to true on the Ribbon and it should work  There are issues with doing this, ButtonDropDowns seem to have issues, but hopefully we will get answers to this.
Nov 21, 2008 at 2:52 PM
That seems to be working well.  Thank you very much.