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

Don't understand point in Application Themes if they don't support all basic controls?

6 Answers 107 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Rob A.
Top achievements
Rank 2
Iron
Iron
Veteran
Rob A. asked on 23 Oct 2020, 01:05 AM

Since you folks don't provide any Telerik Label or TextBox controls, we have to use the Microsoft default controls which I then find out will NOT be themed via StyleManager per this link.  

If using the XML approach, how are we supposed to use themes without key support for two of the most fundamental and basic controls like Label and TextBox?

It makes the entire purpose of "Application level" themes useless without this basic support.

Am I missing something?

Rob.

 

 

6 Answers, 1 is accepted

Sort by
0
Vicky
Telerik team
answered on 26 Oct 2020, 04:42 PM

Hello Rob,

Let me start with the supported mechanisms for setting a Telerik theme - the first one is using StyleManager and the second (newer and recommended one) is using implicit styles. Setting a theme using implicit styles (NoXAML) comes with a lot of advantages, some of which are smaller dlls size and more flexible and easier customization (if needed).

When using the XAML (StyleManager) approach, it is required to define implicit styles targeting the native MS controls for the same to receive the desired theme's styling. The reason for this is that we do not have access to them and cannot set this attached property by default. These styles can be defined on an application level as well.

P.S. The UI for WPF Controls suite actually contains Telerik Label, which is theme aware. You can declare it in XAML like:

<telerik:Label Content="Label content here"/>

I also prepared a sample project demonstrating how to use Telerik themes, defined on an app level, using StyleManager. Please, find it attached to my reply and give it a try.
I hope you find this information helpful and won't hesitate to contact me if any further assistance from my side is needed.

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
Rob A.
Top achievements
Rank 2
Iron
Iron
Veteran
answered on 26 Oct 2020, 05:22 PM

Hi Vicky,

I am using StyleManager with implicit styles (noXAML).  I did find the Telerik version of Label which does indeed work with implicit styles.  However, I'm unable to find a telerik "TextBox" control?

In addition, the Window itself, such as Title, Titlebar color, background don't seem to respond to using implicit styles?

Any suggestions/alternatives?

Cheers, Rob.

0
Vicky
Telerik team
answered on 27 Oct 2020, 08:06 AM

Hi Rob,

Telerik UI for WPF comes with two different types of assemblies - XAML and NoXAML. You need to choose only one version.
Both types of dlls contain the same source code. The only difference is that the XAML assemblies embed also all styles of the controls for all supported Telerik themes. This means that they are bigger in size compared to the NoXAML ones.

Merging theme resource dictionaries when using StyleManager (mixing implicit styles theming and StyleManager) is not supported. It may lead to Incorrect styling or not being able to see a particular control at all. More information on both theming mechanisms and the difference between them can be found in the Setting a Theme documentation article.

Regarding the RadWindow control, when using it with NoXAML (implicit styles), you need to define the following style after the merged dictionaries to make it receive the RadWindowStyle (as it does not automatically). Especially when using it as a MainWindow:

<Application.Resources> 
    <ResourceDictionary> 
        <ResourceDictionary.MergedDictionaries> 
        ...
</ResourceDictionary.MergedDictionaries> <Style TargetType="local:MainWindow" BasedOn="{StaticResource RadWindowStyle}" /> </ResourceDictionary> </Application.Resources>

As for the TextBox control - we do not have a Telerik version of it, but choosing the implicit styling mechanism, you won't have worries with it or any other MS control when the System.Windows.xaml file is merged to your Application's MergedDictionaries.

Please, check out the above suggestions and resources and let me know if there is anything else I can help you with.

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
Rob A.
Top achievements
Rank 2
Iron
Iron
Veteran
answered on 29 Oct 2020, 11:24 PM

Hi Vicky,

Sorry, I provided you with incorrect information ... I'm using XAML (not NoXAML) with StyleManager.

The RadWindow control is operating with my selected Theme (global application wide via StyleManager) as are all my Telerik controls ... all good there.

However, the windows TextBox control is NOT working with any Telerik Theme ... the documentation here suggests I don't need to do anything for those listed MS controls (such as TextBox) since I'm using XAML StyleManager approach.

Am I missing something?

Cheers, Rob.

0
Accepted
Vicky
Telerik team
answered on 02 Nov 2020, 08:10 AM

Hi Rob,

According to the article on how to Use StyleManager to Apply Theme on MS Controls, you need to provide the same theme you chose for an application theme to all your MS controls. Applying an application theme guarantees only for the styling of the Telerik controls. The native ones supported by our theming mechanism require manually setting the corresponding theme to them through a Style, similar to the following one targeting the TextBox control:

<Application.Resources> 
    <telerik:GreenTheme x:Key="Theme" /> 
    <Style TargetType="TextBox"> 
        <Setter Property="telerik:StyleManager.Theme" Value="{StaticResource Theme}"/> 
    </Style> 
</Application.Resources>
My first reply contained a sample project demonstrating how to achieve this in code-behind as well.

Please, try out both suggestions and let me know if there is anything else I can assist you with.

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
Rob A.
Top achievements
Rank 2
Iron
Iron
Veteran
answered on 03 Nov 2020, 06:53 AM

Hi Vicky,

Thank you, that works perfectly!

Cheers, Rob.

Tags
General Discussions
Asked by
Rob A.
Top achievements
Rank 2
Iron
Iron
Veteran
Answers by
Vicky
Telerik team
Rob A.
Top achievements
Rank 2
Iron
Iron
Veteran
Share this question
or