Keep selected item highlighted

5 posts, 1 answers
  1. ManniAT
    ManniAT avatar
    877 posts
    Member since:
    Nov 2003

    Posted 25 Oct 2012 Link to this post

    Hi,

    I know that the default WPF combobox has the same behavior - but maybe RadCombobox can do it better.
    What I want is a ComboBox where the user can select a single item from the dropdown.
    This works so far - but when hovering an item with the mouse the user gets lost because the Selected Item is no longer highlighted.

    Although I could create such a combobox with a togglebutton and a listbox in a popup I would prefer to use RadComboBox.

    Is there a way to achieve this (easily)?

    Thanks
    Manfred
  2. Vladi
    Admin
    Vladi avatar
    744 posts

    Posted 30 Oct 2012 Link to this post

    Hi Manfred,

    There isn't a built-in feature to enable the behavior you are trying to implement but any approach on achieving this behavior shouldn't differ between ComboBox and RadComboBox controls.

    In RadComboBox this could be achieved by creating a class that inherits DataTemplateSelector and then set the ItemTemplateSelector of the control.

    Hope this is helpful.

    Greetings,
    Vladi
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. UI for WPF is Visual Studio 2017 Ready
  4. ManniAT
    ManniAT avatar
    877 posts
    Member since:
    Nov 2003

    Posted 04 Nov 2012 Link to this post

    Do you mean I have to provide three templates.
    One for the  "top item" (in the collapsed combobox), one for the "normal items", and one for the selected item?

    Is there an example showing this?
    And will the template selector be called on hover?

    Manfred
  5. Answer
    Vladi
    Admin
    Vladi avatar
    744 posts

    Posted 05 Nov 2012 Link to this post

    Hi Manfred,

    You should have two styles for the selected item and for the normal items. On the other hand we found an simpler approach on achieving the desired behavior and we create a sample project for you to take a look at. In the project all you need to do is set an ItemTemplate and bind to the IsSelected property of the RadComboBoxItem. It is worth mentioning that this is not the best practice on achieving the desired behavior but it is the simplest one we can provide.

    If you have any followup questions feel free to write to us again.

    All the best,
    Vladi
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  6. ManniAT
    ManniAT avatar
    877 posts
    Member since:
    Nov 2003

    Posted 05 Nov 2012 Link to this post

    Hi Vladi,

    it's simple, it's working - and since I have about 10 items in my combobox no performance problems.
    Thank you for the (as usual with telerik) fast and good support
    Manfred
Back to Top
UI for WPF is Visual Studio 2017 Ready