I have a UWP app for Windows 10 with MVVM Light enabled. I store ViewModelLocator in App.Resources. When I have only ViewModelLocator in my App.Resources, everything works fine.
<Application.Resources> <viewModel:ViewModelLocator x:Key="Locator" /> </Application.Resources>
As soon as I add String, Converter or something similar, the application does not crash, but the ViewModelLocator constructor is no longer called. Errors and exceptions do not occur, only ResourceDictionary does not load or does not work at boot time.
<Application.Resources> <viewModel:ViewModelLocator x:Key="Locator" /> <x:String x:Key="SampleString">Hello</x:String> </Application.Resources>
If I add a style, DataTemplate, Brush, Color - everything will be fine.
Have not noticed this behavior on Windows Phone 8, Silverlignt or WPF before. Moving styles or objects to separate ResourceDictionaries and loading them with MergedDictionaries did not help.
I would like to have a list of objects in a ResourceDictionary so that all the constructors of these objects are called automatically when the application starts. Please inform.
PS :. Even two of these converters do not work, and one is created without any problems.
<Application.Resources> <converters:StringFormatConverter x:Key="StringFormat1" /> <converters:StringFormatConverter x:Key="StringFormat2" /> </Application.Resources>
We are looking for an example of using ResourceDictionary, I found a similar question: Unified ResourceDictionary initialization in a UWP application