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

How to change default selected item colour

2 Answers 376 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
wpfdev
Top achievements
Rank 1
wpfdev asked on 13 Aug 2010, 02:24 PM
Hello,

How could I change the default colour when a mouse moves over a treeview item? Also, how could I change the default colour when a treeview item is selected?

Thanks.

2 Answers, 1 is accepted

Sort by
0
Tina Stancheva
Telerik team
answered on 18 Aug 2010, 02:48 PM
Hello wpfdev,

In order to apply these changes you have to edit the ControlTemplate of the RadTreeView in Blend. More information you can find here.

Then you will be able to modify the default style of the RadTreeView to match your requirements.

In order to modify the MouseOver and Selected background color of the RadTreeViewItem you can modify the MouseOver/Selected resource brushes - ControlSubItem_OuterBorder_MouseOver, ControlSubItem_InnerBorder_MouseOver, ControlSubItem_Background_MouseOver and ControlSubItem_OuterBorder_Selected, ControlSubItem_InnerBorder_Selected, ControlSubItem_Background_Selected.

Another approach is to set the new values in the MouseOver and SelectionVisual Borders:
<!--MouseOver Borders-->
<Border x:Name="MouseOverVisual" Grid.ColumnSpan="6" Grid.Column="2" Opacity="0"
        BorderThickness="{StaticResource ControlSubItem_OuterBorderThickness}"
        BorderBrush="{StaticResource ControlSubItem_OuterBorder_MouseOver}"
        CornerRadius="{StaticResource ControlSubItem_OuterCornerRadius}">
    <Border BorderBrush="{StaticResource ControlSubItem_InnerBorder_MouseOver}"
        BorderThickness="{StaticResource ControlSubItem_InnerBorderThickness}"
        Background="{StaticResource ControlSubItem_Background_MouseOver}"
        CornerRadius="{StaticResource ControlSubItem_InnerCornerRadius}"/>
</Border>
                     
...
 
<!--SelectionVisual Borders-->
<Border x:Name="SelectionVisual" Grid.ColumnSpan="6" Grid.Column="2" Visibility="Collapsed"
        BorderBrush="{StaticResource ControlSubItem_OuterBorder_Selected}"
        BorderThickness="{StaticResource ControlSubItem_OuterBorderThickness}"
        CornerRadius="{StaticResource ControlSubItem_OuterCornerRadius}">
    <Border BorderBrush="{StaticResource ControlSubItem_InnerBorder_Selected}"
        BorderThickness="{StaticResource ControlSubItem_InnerBorderThickness}"
        Background="{StaticResource ControlSubItem_Background_Selected}"
        CornerRadius="{StaticResource ControlSubItem_InnerCornerRadius}"/>
</Border>

I prepared a sample project illustrating the first approach. Please take a look at it and let me know if it works for you or if you need more info.

Regards,
Tina Stancheva
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
0
wpfdev
Top achievements
Rank 1
answered on 19 Aug 2010, 09:22 AM
It helps. Thanks.
Tags
TreeView
Asked by
wpfdev
Top achievements
Rank 1
Answers by
Tina Stancheva
Telerik team
wpfdev
Top achievements
Rank 1
Share this question
or