How to change selected item background color ?

10 posts, 0 answers
  1. Ninh
    Ninh avatar
    6 posts
    Member since:
    Oct 2012

    Posted 17 May 2013 Link to this post

    Hi everyone !
    I want to change item background color when select or mouse hover , help me please !
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 17 May 2013 Link to this post

    Hi Ninh,

    Please have a look at the following code.

        <Style x:Key="myLBStyle" TargetType="{x:Type ListBoxItem}">
                <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}"
    <ListBox ItemsSource="{Binding Path=FirstNames}"
             ItemContainerStyle="{StaticResource myLBStyle}">

  3. Ninh
    Ninh avatar
    6 posts
    Member since:
    Oct 2012

    Posted 17 May 2013 Link to this post

    Hi Shinu ,
     I coded follow you, but I am using RadListBox , it don't change background color  ( ListBox done ). Please tell me the way to change select item background color in RadListBox .
    Thanks ,
  4. Kalin
    Kalin avatar
    1312 posts

    Posted 21 May 2013 Link to this post

    Hello Ninh,

    In order to set different background colors for selected and highlighted state of the items of RadListBox, you should customize the Style of the RadListBoxItem and more specifically the MouseOverVisual and SelectedVisual elements in the template. You can achieve that by using Implicit Styles. I've attached a sample project to demonstrate exactly the needed approach.

    Hope this helps.

    Kind regards,
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  5. Amir
    Amir avatar
    3 posts
    Member since:
    Jul 2012

    Posted 09 Jun 2015 in reply to Kalin Link to this post

    You must be kidding!


    For item selection color change there must be that much code
    change in App.XAML and several other files! How do you expect people figure
    this out.

    And you call your libraries the most intuitive RAD! Selling
    it for thousands dollars!

    What are you smoking out there in Telerik development :-)
  6. Kalin
    Kalin avatar
    1312 posts

    Posted 11 Jun 2015 Link to this post

    Hello Amir,

    Thank you for your feedback. Indeed in this particular case to achieve such a custom appearance of the control you would have to exact and modify the default template of the RadListoBoxItem. As for fact that in the sample project we have modified couple of xaml files - this is so because we are using the Implicit Styling approach. The same result can be achieved with changes in a single file. Note that using Implicit Styles provides the following benefits:

    - Custom themes are done much easier - created only via merged dictionaries
    - Basing styles on a theme is simple
    - Assemblies have smaller size
    - Improved Blend support

    If you have you any other questions, do not hesitate to contact us.

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  7. Elena
    Elena avatar
    1 posts
    Member since:
    Nov 2014

    Posted 17 Mar 2016 in reply to Kalin Link to this post

    Hello Kalin,

    I'm trying to find a way of shading/changing background colour for some items in my RadListBox, is this easier now or is still as complicated as you describe in this thread?

    Kind Regards,


  8. Kalin
    Kalin avatar
    1312 posts

    Posted 21 Mar 2016 Link to this post

    Hi Elena,

    Depending on the exact requirements you could modify only the default Style of the ListBoxItem - this should be pretty easy when using Implicit Styles. However some changes may required modifications in the ControlTemplate of the ListBoxItem which will evolve some more XAML to be extracted from the default themes.

    Please give it a try and if you need further assistance, you could open up a support ticket and attach the project so we can check it on our side and provide you the best solution for the exact requirements. 

    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
  9. Frank
    Frank avatar
    1 posts
    Member since:
    May 2013

    Posted 13 Apr 2016 Link to this post

    I think it is easier if you use a RadTreeView. It would look like a list and you can edit the telerik:RadTreeView.ItemContainerStyle

    Just look for Styling the RadTreeViewItem.

  10. Doug
    Doug avatar
    104 posts
    Member since:
    Aug 2014

    Posted 23 Sep 2016 in reply to Amir Link to this post

    RadListBox1.Items(3).ControlStyle.BackColor = Drawing.Color.AliceBlue
Back to Top