Button inside the items.

2 posts, 0 answers
  1. Ole
    Ole avatar
    36 posts
    Member since:
    Aug 2010

    Posted 19 Jul 2011 Link to this post

    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
  2. Pana
    Admin
    Pana avatar
    748 posts

    Posted 22 Jul 2011 Link to this post

    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!

  3. UI for WPF is Visual Studio 2017 Ready
Back to Top