I changed the build action of my App.xaml to "Page" so I could handle a splash screen and make sure my application run as a single instance only (having my own entry point). It works fine in run-time but in design-time the application cannot see the my resources anymore. Resources are in separate xaml files located in the same project. How can I make my app see the resources in design-time again?
Thanks
Factor your resources out into a separate resource dictionary and then pull them into App.xaml like this:
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="MasterResources.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
You can add multiple resource dictionaries this way as needed.
You also need to do the same thing in UserControls (and Windows that reference UserControls using the resources):
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="MasterResources.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
See http://ithoughthecamewithyou.com/post/Merging-Resource-Dictionaries-for-fun-and-profit.aspx for more on this topic.
Make sure you are calling InitializeComponent()
as the first line of your application's constructor:
public App()
{
// This is the method generated by VisualStudio that initializes
// the application from associated XAML file
InitializeComponent();
// Do everything else
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With