This project is read-only.

A couple of questions (cmd and backstage)

Dec 22, 2010 at 9:52 AM

Hi,

Is it possible to change the backstage 'File' header?

Also, I have tried to hook up a command with a button but I haven't been successful. Can anyone point out what I am doing wrong? Currently the image appears as grey out

<Fluent:Button Name="RBOpen" Header="Open"

 LargeIcon="Images\Open.png"/> 

 <Window.CommandBindings>
<CommandBinding x:Name="cmdOpen" Executed="cmdOpen_Executed" CanExecute="cmdOpen_CanExecute"/>
</Window.CommandBindings>

 

Code behind:

 

 

 

 

 

 

private void cmdOpen_Executed(object sender, ExecutedRoutedEventArgs e)
{
Dialogs.ShowInformation("open", "click");
}

 

private void cmdOpen_CanExecute(object sender, CanExecuteRoutedEventArgs e)
{
e.CanExecute =
true;
}

Thanks

Dec 24, 2010 at 8:26 AM

As for the first question, you can set Ribbon.Localization.BackstageButtonText or just set Header of your Backstage <Fluent:Backstage Background="Green" Header="My Header">...
I don't get the second question... I don't see a command is applied to the button.

Daniel

Dec 27, 2010 at 11:08 AM

Hi Daniel,

thanks, for the backstage info and sorry I forgot some code

<Fluent:Button Name="RBOpen" Header="Open" 

 LargeIcon="Images\Open.png" Command="CmdOpen"/> 

 

 

 <Window.CommandBindings>
<CommandBinding Command="CmdOpen" Executed="cmdOpen_Executed" CanExecute="cmdOpen_CanExecute"/>
</Window.CommandBindings>

private void cmdOpen_Executed(object sender, ExecutedRoutedEventArgs e)
{
Dialogs.ShowInformation("open", "click");
}

private void cmdOpen_CanExecute(object sender, CanExecuteRoutedEventArgs e)
{
e.CanExecute =
true;
}

I get the following error: "Value 'CmdOpen' cannot be assigned to property 'Command'. 'CommandValueSerializer' ValueSerializer cannot convert from System.String

  

Thanks

Dec 27, 2010 at 1:15 PM

I solved it. I have to declare the command :/

public static RoutedUICommand OpenCmd = new RoutedUICommand ....

thanks