I'm new to WPF and I'm converting a WinForms application that I wrote years ago to WPF. This application is an addon to another application and I have to create it as a dll.
I started this as an application to get everything working and then I'm compiling it as a dll. When I show the window from the dll the window shows fine but none of the formatting from the themes is there.
In the application I have the theme in a resource dictionary in the app.xaml.
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Themes/DarkTheme.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
I've changed the build action to page. Am I missing something?
I have a couple of questions:
How do I get the formatting to show correctly on the window from the dll?
When another WPF application opens a window from a dll, does the formatting for the window come from the formatting in the library or does it automatically use the formatting from the opening application?
If it gets its formatting from the opening application, can you set the formatting for just that window with code?
I tried putting the dictionary in the Window resources in the MainWindow.xaml like:
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Themes/DarkTheme.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>
What I need is to be able to open the window from the library with the proper formatting that was used when I built it. Not formatting from the opening aaplication.
Any help would be greatly appreciated. Thanks!