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

Can I customize the Windows8Touch theme Gradient Brushes?

7 Answers 75 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Joe
Top achievements
Rank 2
Iron
Iron
Veteran
Joe asked on 14 Jan 2021, 11:21 PM
I've managed to customize all the colors for the Windows8Touch theme to my liking to make it a generally dark theme.  I get the Windows8TouchPalette at startup and set the colors that the Telerik docs recommend.


However I still do not like the Gradient Background brush.  It appears too light for what I want.  I would like to be able to either directly set it to make it darker or simply make the theme use solid brushes in place of the gradient ones .

Is there a way to directly alter the gradient brushes -- individually - in this theme?   Or is it simply constructed from the colors I specify and I have no other control over it?

7 Answers, 1 is accepted

Sort by
0
Joe
Top achievements
Rank 2
Iron
Iron
Veteran
answered on 19 Jan 2021, 01:40 AM

I am posting to add that after much trial and error, I appear to have stumbled upon setting some palette colors that make my gradient stand out better.  But it would still be nice to understand -- if you can find the time to explain -- what colors go into the gradient and how it is constructed.

0
Martin Ivanov
Telerik team
answered on 19 Jan 2021, 09:06 AM

Hello Joe,

The Windows8 and Windows8Touch palettes doesn't have gradient brushes. There could be custom brushes on your side or maybe some opacity applied to the elements can look like a gradient. If you tell me what controls do you use and send few drawings showing the gradient I can check where it comes from. 

Regards,
Martin Ivanov
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
Joe
Top achievements
Rank 2
Iron
Iron
Veteran
answered on 19 Jan 2021, 03:28 PM
Hi Martin,

I'm sorry to contradict you but the Windows8Touch certainly *does* have a gradient brush.   In fact it has two   The Resource Keys are "MainGradientBrush" and "InvertedGradientBrush"   They are referred to quite often in the Windows8Touch theme XAML files.   I'm just trying to understand how they are constructed
0
Joe
Top achievements
Rank 2
Iron
Iron
Veteran
answered on 19 Jan 2021, 03:39 PM
Sorry I realize your answer was correct, I just asked my question badly.  Let me clarify

I realize that the Windows8TouchPalette doesn't have a gradient brush.  But the Windows8TouchResource brushes are constructed from whatever I set in that palette and it does have the gradient brush.  I'm trying to understand how the colors that I set in the palette go into the resource's gradient brushes and how I can alter things
0
Accepted
Martin Ivanov
Telerik team
answered on 20 Jan 2021, 11:08 AM

Hello Joe,

Thank you for the clarification. The Windows8TouchResource class is a DynamicResourceExtension implementation which contains the brushes and few other properties used in the control styles. The Windows8TouchResource are updated in code when the palette changes. The MainGradientBrush, and InvertedGradientBrush are created using the following code:

	LinearGradientBrush mainGradient = new LinearGradientBrush() { StartPoint = new Point(0.5, 0), EndPoint = new Point(0.5, 1) };
	mainGradient.GradientStops.Add(new GradientStop() { Color = Windows8TouchPalette.Palette.EffectHighColor });
	mainGradient.GradientStops.Add(new GradientStop() { Color = Windows8TouchPalette.Palette.EffectLowColor, Offset = 1 });
	FreezeAndSetResource(ResourceDictionary, Windows8TouchResourceKey.MainGradientBrush, mainGradient);

	LinearGradientBrush invertedGradient = new LinearGradientBrush() { StartPoint = new Point(0.5, 0), EndPoint = new Point(0.5, 1) };
	invertedGradient.GradientStops.Add(new GradientStop() { Color = Windows8TouchPalette.Palette.EffectLowColor });
	invertedGradient.GradientStops.Add(new GradientStop() { Color = Windows8TouchPalette.Palette.EffectHighColor, Offset = 1 });
	FreezeAndSetResource(ResourceDictionary, Windows8TouchResourceKey.InvertedGradientBrush, invertedGradient);

This code executes whenever the EffectLowColor or the EffectHighColor palette properties are updated.

There is no entry point in the resources extension or the palette class that allow changing customizing the gradients. Currently, the approach that I can suggest for such modification is to extract the ControlTemplate of the control where you want to replace the gradient and use a custom brush (with StaticResource or a direct value) instead of the Windows8TouchResource extension.

Regards,
Martin Ivanov
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
Joe
Top achievements
Rank 2
Iron
Iron
Veteran
answered on 20 Jan 2021, 04:16 PM
Excellent.  Thank you that is exactly what I was hoping for.  As long as I understand what colors are used to make the brushes, I am pretty sure I can get the effect I want.  My goal is to avoid customizing specific controls, if possible, so this is very helpful.
0
Martin Ivanov
Telerik team
answered on 21 Jan 2021, 07:10 AM

Hello Joe,

I am glad to hear the provided information helps.

Regards,
Martin Ivanov
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
General Discussions
Asked by
Joe
Top achievements
Rank 2
Iron
Iron
Veteran
Answers by
Joe
Top achievements
Rank 2
Iron
Iron
Veteran
Martin Ivanov
Telerik team
Share this question
or