views:

15

answers:

1

I have a Microsoft Ribbonbar inside a Window, and every RibbonButton is associated to a specific command like this:

<ribbon:Ribbon x:Key="MyToolbar"  Name="MyToolbar"  >         
<ribbon:RibbonTab Header="File" >
<ribbon:RibbonGroup Header="File"  >
<ribbon:RibbonButton Command="{x:Static ApplicationCommands.New}"  LargeImageSource="Images/GenericDocument.png" Label="Nuovo" />
<ribbon:RibbonButton Command="{x:Static ApplicationCommands.Open}" SmallImageSource="Images/OpenFolder.png" Label="Apri"  />
</ribbon:RibbonGroup>
</ribbon:RibbonTab>
</ribbon:Ribbon>

I'm handling the commands in this way into the code-behind of a specific Canvas object placed in the same window:

private void BindApplicationCommands()
{
// FILE group
this.CommandBindings.Add(new CommandBinding(ApplicationCommands.New, New_Executed));
this.CommandBindings.Add(new CommandBinding(ApplicationCommands.Open, Open_Executed,Open_Enabled));
}

When I click outside the Canvas component where the handling code is placed, all the buttons inside the Ribbon become to be disabled. This is an undesired behaviour, since i want that some specific buttons (like the "New" and "Open" commands) are always and globally enabled, despite to where i click. How can I achieve this ? Thanks in advance for any suggestion.

+1  A: 

Ok, I solved my own problem. Since the CommandBindings where defined inside the Canvas component, they weren't manageable into a wider (global) context, so i moved them into the Window code-behind to delegate their execution/activation in a more flexible way. That's all :)

NinjaCross
Even though you were the one to answer the question you should still mark this as the answer.
Bill W
I will when the system allows me to to that. There's a limit of 2 days-wait (for my profile) before I can do it.
NinjaCross