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

Should I include Themes/System.Windows.xaml?

3 Answers 469 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
n/a
Top achievements
Rank 1
n/a asked on 13 Sep 2019, 07:52 PM

Hi,

We're including the NoXaml Telerik DLLs and the Office 2016 theme DLL in our application. We've merged the resources from the various DLLs, including the Themes/System.Windows.xaml resource, as described in Setting a Theme Using Implicit Styles. We've found that this affects the appearance of some non-Telerik controls, such as TextBox, PasswordBox and ScrollViewer. For example, sometimes there are extra borders and sometimes rounded corners are missing (see attached screenshot).

At the bottom of that same page is a short section called Does a Theme Affect All WPF Controls? that confirms that some native WPF controls are affected by Telerik themes. We would like to avoid this. Could you help by answering the following questions:

  • How exactly do Telerik themes affect the appearance of native WPF controls, and why? Is this expected?
  • What is the best way to avoid this? Setting a Theme on MS Controls says that if we want to style one of the affected WPF controls we should merge the System.Windows.xaml resource dictionary when defining our styles. Will this ensure that everything looks the same as it does without the Telerik theme?
  • We've tried removing just the Themes/System.Windows.xaml resource (while keeping the other Telerik resources) and this seems to fix the appearance of native WPF controls. Is this recommended? What side-effects might this have.

Thanks.

3 Answers, 1 is accepted

Sort by
0
Vladimir Stoyanov
Telerik team
answered on 16 Sep 2019, 03:40 PM

Hello,

Thank you for the provided picture. 

The System.Windows.xaml ResourceDictionary contains styles for some of native WPF controls. If you merge this resource, provided that you do not set a style with a higher priority, those controls will receive an implicit style from that ResourceDictionary. You can open the System.Windows.xaml file for the theme that you are using from the Themes.Implicit folder in your UI for WPF installation directory to see all the styles that are within that ResourceDictionary. 

If you don't want the native WPF controls' styles to be altered, you can simply avoid merging the System.Windows.xaml ResourceDictionary. This will not cause any side effects for the UI for WPF controls. 

I hope you find this helpful.

Regards,
Vladimir Stoyanov
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Jason D
Top achievements
Rank 1
Veteran
answered on 03 Oct 2019, 07:36 PM

Note that if you don't include the file, some controls will not show in the Designer, such as the Tab Control. You don't need to include it in your application, but it does need to be accessible at design time. For example:
https://antonymale.co.uk/design-time-resources-in-wpf.html

Here is how mine is set up:

    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="../src/Themes/System.Windows.xaml"/>
        <ResourceDictionary Source="pack://application:,,,/src/Themes/Telerik.Windows.Controls.xaml"/>
        <ResourceDictionary Source="pack://application:,,,/src/Themes/Telerik.Windows.Controls.DataVisualization.xaml"/>
        <ResourceDictionary Source="pack://application:,,,/src/Themes/Telerik.Windows.Controls.Input.xaml"/>
        <ResourceDictionary Source="pack://application:,,,/src/Themes/Telerik.Windows.Controls.Navigation.xaml"/>
    </ResourceDictionary.MergedDictionaries>
</ResourceDictionary>

0
Martin Ivanov
Telerik team
answered on 08 Oct 2019, 06:17 AM

Hello Jason,

Thank you for sharing the additional information.

Regards,
Martin Ivanov
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
General Discussions
Asked by
n/a
Top achievements
Rank 1
Answers by
Vladimir Stoyanov
Telerik team
Jason D
Top achievements
Rank 1
Veteran
Martin Ivanov
Telerik team
Share this question
or