CanExecut not called for collapsed Ribbon elements

Ribbon for WPF Forum

Posted 7 years ago by vadim
Version: 14.2.0611
Platform: .NET 4.5
Environment: Windows 10 (64-bit)
Avatar

Hello.

I'm use next command callback

 private void OnNextCanExecuted(object sender, CanExecuteRoutedEventArgs e)
{
     var bt = e.Parameter as UIElement;
     if (bt != null)
     {
          bt.Visibility = (Surfaces?.Count ?? 0) > 1 ? Visibility.Visible : Visibility.Collapsed;
     }

     e.CanExecute = (Surfaces?.Count ?? 1) - 1 > CurrentSurface;
}
<ribbon:Button Command="d3e:SurfaceCommands.Next" CommandParameter="{Binding RelativeSource={RelativeSource Self}}"/>

 When visibility collapsed -  OnNextCanExecuted never call

For simple WPF Button all work good.

How can I resolve it.

Comments (1)

Posted 7 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

At a quick glance, I'm not seeing that we have any code preventing can-execute from being called for collapsed buttons.  But I wouldn't really expect any commands to be examined for collapsed controls.  Even if the standard WPF Button is doing it, it doesn't seem like a good idea since it's wasting processing cycles for controls that aren't even shown.


Actipro Software Support

The latest build of this product (v23.1.3) was released 23 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.