This is a migrated thread and some comments may be shown as answers.

Button inside the items.

1 Answer 237 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Ole
Top achievements
Rank 1
Ole asked on 19 Jul 2011, 11:30 AM
Hi,

I am looking for a way to have a button as the first item in a combobox list just like the clear button. However I dont want to clear the selectedItem but want the user to be able to create a new item for the combox list via a popupwindow and then put that new item as the selected item.

I have not been able to catch the event when clicking on the clear btn. is that possible to catch it? 

Or some other idears ?

Thanks

Ole

1 Answer, 1 is accepted

Sort by
0
Pana
Telerik team
answered on 22 Jul 2011, 08:58 AM
Hello,

You could create a routed command. Get the RadComboBox's ControlTemplate from the installation folder. For example on my computer it is here:

C:\Program Files (x86)\Telerik\RadControls for WPF Q2 2011\Themes\OfficeBlack\Themes\Office\Black\ComboBox.xaml

Add a button in the RadComboBox's ControlTemplate in its popup right below the Clear button. I believe there is a Grid there you could just add one more RowDefinition and put your button there. Add the routed command on the Button.

Now the good thing about routed commands is they bubble up the visual tree so you should be able to catch them in the RadComboBox, open a modal window, collect some data in a form and when the user is done editing add that item to the RadComboBox's ItemsSource and select it.

Does it make sense?

All the best,
Pana
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

Tags
ComboBox
Asked by
Ole
Top achievements
Rank 1
Answers by
Pana
Telerik team
Share this question
or