Cannot find system.windows.xaml for MergedDictionaries

2 Answers 48 Views
Styling Window
Johnathan
Top achievements
Rank 1
Johnathan asked on 19 Jul 2022, 05:38 PM

   I'm currently running Visual Studio 2022 64-bit, latest version on Windows 11, latest version.  My project is targeting .NET Framework 4.8.  I'm running the latest version of the Telerik Tools for WPF R2 2022 SP1.

   I'm attempting to create a custom implementation of RadWindow by inheriting from it, for example, my base class looks like:

Namespace Windows
    Partial Public Class TBaseRadWindow
        Inherits Telerik.Windows.Controls.RadWindow
        Implements System.ComponentModel.INotifyPropertyChanged, IDisposable
....
  End Class
End Namespace

   When I show my derived Window which comes from this class, I get a tiny, blank RadWindow with no chrome.  Based on my reading, it appears this is caused by NoXAML and the need for the styles to be added to the application's ResourceDictionary.  I'm attempting to follow the instructions from this forum post:  https://www.telerik.com/forums/unable-to-display-a-radwindow
   The forum post says to add these resources to the MergedDictionary this way:

<Application.Resources>
    <ResourceDictionary>
        <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="Themes/System.Windows.xaml" />
            <ResourceDictionary Source="Themes/Telerik.Windows.Controls.xaml" />
            <ResourceDictionary Source="Themes/Telerik.Windows.Controls.Navigation.xaml" />
          </ResourceDictionary.MergedDictionaries>
        <Style TargetType="local:PreferencesView" BasedOn="{StaticResource RadWindowStyle}" />
    </ResourceDictionary>
</Application.Resources>

   However, when I add these three items to my MergedDictionaries (I have one already that works fine) when I compile I get an error "IO Exception: Cannot location resource "themes/system.windows.xaml".  

   My project references System.Windows, Telerik.Windows.Controls, and many others.  Where can I get this system.windows.xaml from?

 

2 Answers, 1 is accepted

Sort by
0
Masha
Telerik team
answered on 20 Jul 2022, 08:29 AM

Hello Johnathan,

You can find  System.Windows.xaml,Telerik.Windows.Controls.xaml and Telerik.Windows.Controls.Navigation.xaml files from the Themes.Implicit folder in your installation directory depending on the theme you are using.

I hope this helps.

Regards,
Masha
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Johnathan
Top achievements
Rank 1
commented on 20 Jul 2022, 04:59 PM

Thank you Masha, unfortunately that did not fix the problem.  To be clear, I need to create a custom extension of RadWindow to include some bindable properties:

Namespace Windows
    Partial Public Class TBaseRadWindow
        Inherits Telerik.Windows.Controls.RadWindow
        Implements System.ComponentModel.INotifyPropertyChanged, IDisposable
...
End Class
End Namespace

   I then create a RadWindow that inherits from this class:

<base:TBaseRadWindow x:Class="Window.RadWinEI"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:Redstone"
        xmlns:localcontrols="clr-namespace:Redstone.Controls"
        xmlns:base="clr-namespace:Redstone.Windows"
        xmlns:panes="clr-namespace:Redstone.Panes"
        xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
        xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
        xmlns:telerikControls="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls"
        xmlns:navigation="clr-namespace:Telerik.Windows.Controls.Navigation;assembly=Telerik.Windows.Controls.Navigation"
        mc:Ignorable="d"
                           navigation:RadWindowInteropHelper.ShowInTaskbar="True" 
                           navigation:RadWindowInteropHelper.Title="Estimate Item Editor"
        WindowStartupLocation = "CenterScreen"
        Header="Estimate Item Editor"
        d:DesignHeight="1000" d:DesignWidth="1800"
                     Style="{DynamicResource RadWindowStyle}"
                   >
...
</base:TBaseRadWindow>

Namespace Windows
    Partial Public Class RadWinEI
        Inherits Windows.TBaseRadWindow
...

End Class
End Namespace

   From what I've read, if I do this, I must merge the dictionaries for the themes for some reason.    I have copied all the Themes from the Themes.Implicit folder into my application. 
   In Application.xaml I have merged them:

    <Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
               <ResourceDictionary Source="/Resources/TelerikThemes/VisualStudio2013/Themes/System.Windows.xaml"/>

                <ResourceDictionary Source="/Resources/TelerikThemes/VisualStudio2013/Themes/Telerik.Windows.Controls.xaml"/>
                <ResourceDictionary Source="/Resources/TelerikThemes/VisualStudio2013/Themes/Telerik.Windows.Controls.Navigation.xaml"/>
            </ResourceDictionary.MergedDictionaries>

...
            <Style TargetType="redstoneWindows:TBaseRadWindow" BasedOn="{StaticResource RadWindowStyle}"/>

</ResourceDictionary>
</Application.Resources>

   When I instantiate a new instance of this Window I get the attached example, blank RadWindow with nothing.

Johnathan
Top achievements
Rank 1
commented on 20 Jul 2022, 05:00 PM

Sample Windows:


0
Masha
Telerik team
answered on 21 Jul 2022, 06:06 AM

Hi Johnathan,

I'm not sure what may cause the problem from the provided code snippet. I created a sample demo with the VisualStudio2013 theme where the approach is demonstrated and all styles are applied. Please note it is good to use NoXAML binaries in the application in order for everything to work correctly.

Please take a look and let me know if this will work for you.

Regards,
Masha
Progress Telerik

The Premier Dev Conference is back! 

Coming to you live from Progress360 in-person or on your own time, DevReach for all. Register Today.


Tags
Styling Window
Asked by
Johnathan
Top achievements
Rank 1
Answers by
Masha
Telerik team
Share this question
or