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

RadTreeViewItem and Dark Fluent

3 Answers 121 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
smr
Top achievements
Rank 1
smr asked on 22 Feb 2021, 04:10 PM

Hi

 

I tried the dark Fluent style for RadTreeView but it didn't work well.

where is the problem from?

Look at the pictures

3 Answers, 1 is accepted

Sort by
0
Accepted
Vicky
Telerik team
answered on 23 Feb 2021, 07:43 AM

Hi,

Thanks for the provided screenshots - they were of great help.

The RadTreeView in the Fluent theme has a transparent background by default. This means that the background behind it will be taken and for this theme may lead to the result from your screenshots. In your case, I can see that a gray (#F0F0F0) background is applied to the RadTreeView or the parent panel behind it.

Removing this gray background will result to the correct and default look and feel of the RadTreeView. You can take a look in the Telerik WPF Demos application and the Theming demo of the control:

Best Regards,
Vicky
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
smr
Top achievements
Rank 1
answered on 23 Feb 2021, 01:38 PM

thank you for answer ♥

i wrote this for dark style

 

<Style TargetType="telerik:RadTreeView" BasedOn="{StaticResource RadTreeViewStyle}">
     <Setter Property="Background" Value="#3c3c3c"/>
</Style>

 

 

How could I write code that works for both light and dark style?

only in app.xaml

0
Accepted
Vicky
Telerik team
answered on 24 Feb 2021, 07:48 AM

Hi,

For colors/brushes that change with a Telerik theme's color variation, it is best to use such from the theme's Palette. The default colors for the Fluent theme are described in the following article.

For your case, I think that the ComplementaryColor, AlternativeColor or PrimaryBackgroundColor will be suitable. If your app needs a gray background (#f0f0f0 from your screenshots) of the RadTreeView when the Fluent theme is used in its light variation, and a darker background when using the dark variation, I think that the AlternativeColor is the best.

Each theme palette color forms a SolidColorBrush, i.e., the AlternativeColor corresponds to the AlternativeBrush. This means that your Style needs to be modified to the following:

<Style TargetType="telerik:RadTreeView" BasedOn="{StaticResource RadTreeViewStyle}">
     <Setter Property="Background" Value="{telerik:FluentResource ResourceKey=AlternativeBrush}"/>
</Style>

This will result to (Fluent Light theme on the left, Fluent Dark on the right with an AlternativeBrush as the RadTreeView's background):

Please, try the above and let me know if it works for you. I am looking forward to your reply.

Best Regards,
Vicky
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
TreeView
Asked by
smr
Top achievements
Rank 1
Answers by
Vicky
Telerik team
smr
Top achievements
Rank 1
Share this question
or