Triggers on Ribbon Buttons

Ribbon for WPF Forum

Posted 9 years ago by Martin de Jong - Statistics Netherlands
Version: 9.1.0507
Avatar
Hi

In a contextmenu i want to hide the Buttons instead of make them disabled. All buttons are connected to a (Ribbon)command.
        <Style x:Key="ContextButton" TargetType="ribbon:Button">
            <Style.Triggers>
                <Trigger Property="IsEnabled" Value="True" >
                    <Setter Property="Visibility" Value="Visible" />
                </Trigger>
                <Trigger Property="IsEnabled" Value="False" >
                    <Setter Property="Visibility" Value="Collapsed" />
                </Trigger>
            </Style.Triggers>
        </Style>
.....
   <ribbon:Button Command="ide:ApplicationCommands.CloseSolution" 
           Style="{StaticResource ContextButton}" />

Somehow the buttons disappear... i guess the " collapsing" works but never re-appear.

What to do:)

Regards
Martin

Comments (1)

Posted 9 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Martin,

We have an optimization in there to keep performance of the application high so that invisible controls don't update their can execute state. Try this, inherit a ribbon:Button and override its CanUpdateCanExecuteWhenHidden property to return true. Use an instance of that inherited class and see if it works for you.


Actipro Software Support

The latest build of this product (v2018.1 build 0675) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.