I want to extend the WPF Combobox in a way that two buttons are displayed next to the combobox. I cannot use a UserControl, because I need to specify the items of the combobox in pure xaml like this:
<CustomComboBox>
<CustomComboBoxItem />
<CustomComboBoxItem />
</CustomComboBox>
I’m quite scared to take the template of the combobox and extend it, because for comboboxes it is very large and complex. I’m looking for an easy and simple solution to create that kind of ComboBox-like ItemsControl with just two buttons attached to it. Suggestions welcome!
Edit: Conrete example using a
UserControl:Xaml:
Code:
Usage:
Appearance:
A UserControl should do fine, you can still specify the items in Xaml markup, e.g. if i have a time user control i can do this:
That way you can set the hours in XAML:
You should be able to adapt this to set the items of your ComboBox.