Selected Item Background Color with Implicit Styles

2 posts, 0 answers
  1. Steven
    Steven avatar
    10 posts
    Member since:
    Mar 2011

    Posted 15 Nov 2013 Link to this post


    I'm trying to remove the background color for a selected RadTreeViewItem and have so far not had much luck. I have tried following the documentation to create a copy of the ItemContainerStyle, but none of the brushes (ControlSubItem_ etc) seem to be picked up - in fact, I don't seem to get any template at all.

    What is the easiest way to remove this highlight and is there any differences when using the implicit styles?


  2. Evgenia
    Evgenia avatar
    1397 posts

    Posted 20 Nov 2013 Link to this post

    Hi Steven,

    Have you tried to edit the ControlTemplate of the RadTreeViewItem in ExpressionBlend following the approach described here? In the RadTreeViewItem template there are MouseOverVisual  andSelectedVisual elements, that define the borders displayed during the Selected and MouseOvervisual states of the control.
    When you edit the ControlTemplate of the RadTreeViewItem in Blend, all related resources should be generated as well, including the following brushes:
    • ControlSubItem_OuterBorder_MouseOver - defines the MouseOver state outer border color
    • ControlSubItem_InnerBorder_MouseOver - defines the MouseOver state inner border color
    • ControlSubItem_Background_MouseOver - defines the MouseOver state background color
    • ControlSubItem_OuterBorder_Selected - defines the Selected state outer border color
    • ControlSubItem_InnerBorder_Selected - defines the Selected state inner border color
    • ControlSubItem_Background_Selected - defines the Selected state background color
    Since the MouseOver/Selected background colors are defined by theControlSubItem_Background_MouseOver and ControlSubItem_Background_SelectedLinearGradientBrushes, if you want to keep the borders and remove only the background colors, you can replace these brushes with SolidColorBrushes with Transparent color:

    <SolidColorBrush x:Key="ControlSubItem_Background_MouseOver"
                             Color="Transparent" />
    <SolidColorBrush x:Key="ControlSubItem_Background_Selected"
                             Color="Transparent" />

    I have also attached a sample project illustrating this approach.

    Of course this can be done via our Implicit Styles mechanism - for the purpose you'll need to edit the ControlTemplate of RadTreeViewItem in Telerik.Windows.Controls.Navigation.xaml file and merge the modified file in your App.xaml resources. For the purpose please follow this help topic. It is up to you to pick the most suitable approach for you - whether to modify the Color via Blend or via Implicit styles mechanism.

    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  3. DevCraft banner
Back to Top