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

Selected Item Background Color with Implicit Styles

1 Answer 82 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Steven
Top achievements
Rank 1
Steven asked on 15 Nov 2013, 12:07 PM
Hi,

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?

Cheers,

Steven

1 Answer, 1 is accepted

Sort by
0
Evgenia
Telerik team
answered on 20 Nov 2013, 12:52 PM
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.

Regards,
Evgenia
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
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 >>
Tags
TreeView
Asked by
Steven
Top achievements
Rank 1
Answers by
Evgenia
Telerik team
Share this question
or