PopupButton enabled by child items

Ribbon for WPF Forum

Posted 10 years ago by Kris Goossens - Remmicom
Version: 9.1.0505
Platform: .NET 3.5
Environment: Windows 7 (32-bit)
Avatar
Hi,

Documentation says :
=====
Disabling When Child Items Are All Disabled
One of the ribbon UI design requirements is that when a popup button's child items are all disabled, the popup button must also be disabled. Because of the way WPF commands work, the PopupButton control only examines child items if a command is assigned to its Command property. So as long as you have a command set to the PopupButton, this functionality will work. If you need to use a temporary command while prototyping, use ApplicationCommands.NotACommand.

If you would like to prevent this automated functionality from occurring, you can set the AutoDisableWhenPopupContentIsDisabled to false.
=====

So we used Command="ApplicationCommands.NotACommand", but the popup button does not get enabled anymore.
(Worked fine in version 4.5.0483)

This is all you need to reproduce the problem :

<Ribbon:RibbonWindow x:Class="Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Ribbon="http://schemas.actiprosoftware.com/winfx/xaml/ribbon"
Title="Window1" Height="400" Width="600">
<DockPanel>
<Ribbon:Ribbon DockPanel.Dock="Top" >
<Ribbon:Tab Label="test">
<Ribbon:Group>
<Ribbon:PopupButton Label="Try to copy" AutoDisableWhenPopupContentIsDisabled="True" Command="ApplicationCommands.NotACommand" >
<Ribbon:Menu>
<Ribbon:Button Label="Copy does not get enabled anymore" Command="Copy"/>
</Ribbon:Menu>
</Ribbon:PopupButton>
<Ribbon:Button Label="Copy enabled when selection not empty = ok" Command="Copy"/>

</Ribbon:Group>
</Ribbon:Tab>
</Ribbon:Ribbon>
<TextBox />
</DockPanel>
</Ribbon:RibbonWindow>

Comments (3)

Posted 10 years ago by Kris Goossens - Remmicom
Avatar
In addition (but we don't need this one),

setting AutoDisableWhenPopupContentIsDisabled="False"

doesn't help either.
PopupButton stays disabled.

Grtz,
Kris G
Posted 10 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Kris,

Thanks for the post, it looks like a change we made since then to allow the Command property to control the enabled state of the button if set broke this. We've updated our code for the upcoming maintenance release to not kick in our new code if the command is set to ApplicationCommands.NotACommand.

Thus in the next build, if the PopupButton.Command is set to ApplicationCommands.NotACommand, it will behave like it did in 4.5. If you set another command, that command will directly control the enabled state of the button. If no command is set and AutoDisableWhenPopupContentIsDisabled is false, it will remain enabled.


Actipro Software Support

Posted 10 years ago by Kris Goossens - Remmicom
Avatar
Hi,

I just used release 9.1.0506 and the PopupButton gets enabled again.

Thanks for the quick fix !

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

Add Comment

Please log in to a validated account to post comments.