ribbon:ComboBox leave popup open

Ribbon for WPF Forum

Posted 6 years ago by Ralph
Version: 17.2.0662
Avatar

I noticed StaysOpenOnClick property which prevents the parent popup from closing.  Unfortunately it doesn't seem to affect the drop down part of ribbon:ComboBox.

I'm trying to implement a multiselect ComboBox and I want its drop down part to stay open while the user clicks the checkboxes and only close it when the user clicks outside the ComboBox.  Any suggestions how to implement it?

Comments (4)

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

Hi Ralph,

So that I can better understand what you are doing, are you making a completely custom control that inherits from ComboBox and you have that in a popup, such as for a PopupButton?  And you want clicks on the ComboBox's popup to not close the popup that contains the ComboBox itself?

[Modified 6 years ago]


Actipro Software Support

Posted 6 years ago by Ralph
Avatar

My plan is to inherit from ribbon ComboBox and change its behaviour so that instead of just item names the drop down section displays a list of checkboxes and the main textbox part displays a comma separated list of selected items.   It will be bound to a flags enum property in the viewmodel.  The drop down part of the ComboBox should stay open while the user clicks the checkboxes and it should close when either Escape is pressed or the user clicks anywhere outside the ComboBox. The main problem for me is forcing the drop down part to stay open.  Is it something you can control within the ribbon ComboBox, or is it a problem completely unrelated to Actipro controls?

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

Hi Ralph,

At least from using Reflector and looking at ComboBoxItem, Microsoft has an OnMouseLeftButtonUp override that ends up calling a method in ComboBox that will close the popup.  You might need to create a class that inherits ComboBoxItem and overrides that method to not call the base logic.  Then you'd have to override ComboBox.GetContainerForItemOverride to return an instance of your new class instead.


Actipro Software Support

Posted 6 years ago by Ralph
Avatar

Thanks for that, it worked indeed.

Unfortunately further down my implementation I hit numerous problems and I finally gave up the idea of inheriting from ComboBox, it had too many internal and private members which were critical to its behaviour.

I ended up inheriting from ListBox instead.  I based my control on the following project:

https://www.codeproject.com/Articles/45782/A-WPF-Combo-Box-with-Multiple-Selection

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

Add Comment

Please log in to a validated account to post comments.