[Solved] Change background color of selected row in TreeListViewRow

0 Answers 15 Views
TreeListView
Rajdeep
Top achievements
Rank 1
Rajdeep asked on 12 Mar 2026, 11:41 AM

Hello Telerik Team,

I am currently working with TreeListView in a WPF application and I am facing an issue related to row background color overriding when a row is selected.

In my application, certain rows need to have a custom background color depending on their type (for example: LocalFile and RemoteFile). The custom color works correctly when the row is not selected.

However, when the row is selected, the default RadTreeListView selection background color overrides the custom color, and the File-specific color is no longer visible.

My goal is to preserve the custom background color when the row is selected.

Below is a simplified version of the style currently used:

<Grid.Resources>
 
    <​Style TargetType="telerik:TreeListViewRow">
 
        <!-- Default row color based on data -->
        <Setter Property="Background">
            <Setter.Value>
                <Binding Path="FileSource">
                    <Binding.Converter>
                        <converter:SourceTypeToColorConverter/>
                    </Binding.Converter>
                </Binding>
            </Setter.Value>
        </Setter>
 
        <Setter Property="MouseOverBackground" Value="LightBlue"/>
 
        <​Style.Triggers>
 
            <!-- Default selected row color -->
            <Trigger Property="IsSelected" Value="True">
                <Setter Property="Background" Value="LightBlue"/>
            </Trigger>
 
            <!-- Selected color for local files -->
            <MultiDataTrigger>
                <MultiDataTrigger.Conditions>
                    <Condition Property="IsSelected" Value="True"/>
                    <Condition Binding="{Binding FileSource}" Value="LocalFile"/>
                </MultiDataTrigger.Conditions>
                <Setter Property="Background" Value="LightGreen"/>
            </MultiDataTrigger>
 
            <!-- Selected color for remote files -->
            <MultiDataTrigger>
                <MultiDataTrigger.Conditions>
                    <Condition Property="IsSelected" Value="True"/>
                    <Condition Binding="{Binding FileSource}" Value="RemoteFile"/>
                </MultiDataTrigger.Conditions>
                <Setter Property="Background" Value="LightYellow"/>
            </MultiDataTrigger>
 
        <​/Style.Triggers>
 
    <​/Style>
 
</Grid.Resources>

The issue occurs when the row becomes selected. The control applies the default selection background, which overrides these custom styles.
Could you please advise on the recommended way to maintain custom row background colors for specific items even when they are selected in TreeListView?
Any guidance or best practice would be greatly appreciated.
Thank you.

Stenly
Telerik team
commented on 12 Mar 2026, 01:52 PM

Hello Rajdeep,

I provided a reply on the original forum thread that you opened regarding this requirement:

Change background color of selected row in TreeListViewRow in UI for WPF | Telerik Forums

With this in mind, I would suggest following up with additional questions or information there, so that the conversation can be kept in one place only, so that it can be beneficial for other users.

Rajdeep
Top achievements
Rank 1
commented on 16 Mar 2026, 11:45 AM

Hello Stenly,


By mistake, I have posted two of the same comments. 

No answers yet. Maybe you can help?

Tags
TreeListView
Asked by
Rajdeep
Top achievements
Rank 1
Share this question
or