Reputation: 1720
Due to circumstances beyond my control I must host some WPF screens inside a Windows Form app as an MDI child. I belive I know how to do this and have moved almost everything over. However I am not sure what to do with the Styles set in my App.xaml file.
How / where do I set a Global Styles reference?
Upvotes: 0
Views: 520
Reputation: 2695
since the App.xaml
file is ignored in a WinForms app you will have to use a RecourceDictionary in watherver your UI root control is:
<Page.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="myresourcedictionary.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Page.Resources>
to include local resources you would frist create a ResourceDictionary
for your local resources and then add the MergedDictionaries
like so:
<Page.Resources>
<ResourceDictionary>
<!--local resources-->
<Style x:Key="My Style">
...
</Style>
<!--"global" resources from file-->
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="myresourcedictionary.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Page.Resources>
Upvotes: 1