Fluent:Button.Command don´t fired

Aug 2, 2012 at 10:36 AM

I have a RoutedCommand MyRoutedCommands.MySaveRoutedCommand

I bind to this command in a component:

CommandBinding command = new CommandBinding(MyRoutedCommands.MySaveRoutedCommand);
            command.CanExecute += new CanExecuteRoutedEventHandler(save_CanExecute);
            command.Executed += new ExecutedRoutedEventHandler(this.save_Executed);

But save_CanExecute don't fired.

<Fluent:Button Name="btnSaveWord"  Header="Push Me" ButtonBase.Command="ContainerRoutedCommand.SaveRoutedCommand"  >

If I change Fluent:Button by Button the Command is fired.


Dec 18, 2012 at 1:51 AM

I found the bug

it is because the Backstage Panel that contains the button is hidden before calling base.Click(), to correct the bug you need to change with this code in Button.cs

/// <summary>
        /// Called when a <see cref="T:System.Windows.Controls.Button"/> is clicked.
        /// </summary>
        protected override void OnClick()
           // Call Click first
           // Close popup on click
            if(IsDefinitive) PopupService.RaiseDismissPopupEvent(this,DismissPopupMode.Always);