Adding a button inside a ComboBox/BarComboBox

Themes, Shared, and Core Libraries for Avalonia Forum

Posted 1 month ago by Grzegorz Z
Avatar

Is it possible to add an additional button to the ComboBox/BarComboBox?

For example, I want the ability to select items from the ComboBox and create a new item by clicking a button.

Of course, I can place a button next to the BarComboBox, but it would look better if there were an option to add a button before the button that opens the popup.

Comments (4)

Posted 1 month ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

While we don't have anything in the templates that would support injecting an embedded button, you could update a control template to add another button.  Or as you said, putting a button next to the combo box control is second option.

Another option if you use BarComboBox would be to add a menu item at the bottom of the popup menu.  You can see that concept in our font family BarComboBox in our Ribbon demo.  There we have a "Search for More Fonts" menu item at the bottom of the popup menu.  You could have an add new item menu item in place of that.


Actipro Software Support

Posted 1 month ago by Grzegorz Z
Avatar

1. I see that BarComboBox has a TemplatePart PART_DropDownButton, but I'm not sure how to view its contents and potentially modify it.
2. The idea of an additional item in the popup menu is interesting. Is it possible to place such an item at the top of the menu (as the first element)?

Answer - Posted 1 month ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

1) Our default control themes and templates are available for download by Actipro Avalonia Pro customers.  If you've licensed Actipro Avalonia Pro, you can download and clone our control theme and tweak it as needed in your Application.Resources.

2) The additional menu item is probably preferred since it wouldn't require any theme/template updates.  Our sample adds the menu item to the BelowMenuItems collection property, but you'd want to use AboveMenuItems instead for your scenario.


Actipro Software Support

Posted 1 month ago by Grzegorz Z
Avatar

Thank you for the information. Your controls are excellent, so I will soon become your customer. :)

Add Comment

Please log in to a validated account to post comments.