popupbutton and prevent closing

Ribbon for WPF Forum

Posted 12 years ago by Arthur Damen
Version: 11.2.0551
Avatar
Hi,
I have a popup button that opens when clicked on and shows a usercontrol that is inside. This control has for example a button. But when the user hits the button, i do not want the popup to be closed. Is there a way to prevent this. Is there a way to use the ispopupopen to do this manually? Only when the user hits a region besides the popup, it may be closed.

    <ribbon:PopupButton Label="Play List"  ImageSourceLarge="{x:Static res:Images.edit_playlist_32x32}" VariantSize="Large"  >
      <ribbon:Menu >
        <Grid Width="420" Height="300" Margin="8">
          <Grid> ........some element created.........</Grid>
      </ribbon:Menu>
    </ribbon:PopupButton>

Comments (6)

Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Arthur,

If you are using ribbon:Button on your popup, then you can set its StaysOpenOnClick property to true. That should keep the popup open, I believe.


Actipro Software Support

Posted 12 years ago by Arthur Damen
Avatar
it still is closed.
Can it have to do with the focus?

is there a way to prevent it from being closed when the focus changes?
I know this is not default behaviour. In the control there is a button that changes between grid view and table view and it closes the menu.

I also have a button that opens a file open dialog, and this also closes the menu.
In this case I also want to prevent the menu from being closed.
Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Arthur,

Yes focus moves close popups as well. In a basic scenario the StaysOpenOnClick (on the button being clicked) will prevent a popup from being closed. But if you are moving focus outside the popup directly or indirectly then that will also close a popup.

Perhaps by swapping your controls, if they contained the focus before the swap, WPF is moving the focus outside of them at swap time. Maybe create some focusable control on the popup that is above the controls being swapped and focus that before you swap.


Actipro Software Support

Posted 12 years ago by Arthur Damen
Avatar
what do you exactly mean by being swapped?
Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Arthur,

Swap means to replace one thing by another. You said you are switching between grid view and table view. I assume that means you are replacing one set of controls (or at least a control's templated elements) with another to do so.


Actipro Software Support

Posted 12 years ago by Arthur Damen
Avatar
I think that is the easiest one to solve. I now collapse the first and make visible the second. probably i will have to first make the one visible, and second hide the old one.

The brainbraker is the one where i open a file dialog from the control and still want to leave the popup open (read: use the contextmenu in a way that is not normal...)
The latest build of this product (v24.1.1) was released 21 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.