PopupButton

Ribbon for WPF Forum

Posted 15 years ago by Owen Christensen - Software Engineer, Minitab Inc.
Version: 9.1.0500
Avatar
System: .NET 3.5, Windows Vista, 64-bit

<Ribbon:Ribbon>
    <Ribbon:Tab Label="Tab">
        <Ribbon:Group Label="Group">
            <Ribbon:PopupButton Label="PopupButton">
                <Ribbon:Menu IsEnabled="True">
                    <Ribbon:Button Command="{StaticResource ButtonOneCommand}"/>
                    <Ribbon:Button Command="{StaticResource ButtonTwoCommand}"/>
                </Ribbon:Menu>
            </Ribbon:PopupButton>
        </Ribbon:Group>
    </Ribbon:Tab>
</Ribbon:Ribbon>
CanExecuteHandlers do
CanExecute = true
The PopupButton is not enabled.

Full Sample Here

[Modified at 09/15/2009 09:57 AM]

Comments (4)

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

The problem here seems to be our feature where PopupButton tries to disable itself if all the contained menu items are disabled. What happens is that it is checking whether the menu items (buttons) are enabled. Since they have commands but there are no command bindings set up at the time of checking, they are disabled. The Window.Load event then fires, adding the bindings, but nothing tells the buttons to update the parent popup button.

A workaround for this issue is to move your bindings setup code to the constructor after InitializeComponent. Everything works then.

Alternatively you can turn off the auto-disable feature by setting PopupButton.AutoDisableWhenPopupContentIsDisabled = false.


Actipro Software Support

Posted 15 years ago by Owen Christensen - Software Engineer, Minitab Inc.
Avatar
We have a multiple view interface (in tabs specifically) and with the way routed commands work in WPF, any commands that are used in more than one view will also be executed even if the view is no currently the "active" one, so we have to register and unregister commands/commandbindings on the fly as views are shown and hidden. I've tried CommandManager.InalidateRequerySuggested() after the view state changes but to no avail.

In the short term we've simply created another command and OR'ed together the results of the can executes from the pertinent button commands.

Is there another solution to this?


[Modified at 09/16/2009 11:41 AM]
Posted 15 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
The other thing we did for another customer who has disabling issues was have PopupButton support a Command of its own. So you can make a command just to determine if the PopupButton should be disabled or not, based on whether the command can execute. That would probably work for you too here.


Actipro Software Support

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


Actipro Software Support

The latest build of this product (v24.1.2) was released 1 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.