by Laurent Bugnion via Silverlight on 10/26/2010 6:49:17 AM
I guess this is one of these places where using Blend is an advantage… since I do these operations mostly with the help of the tool, the XAML is generated and I don’t need to think about it too much.
There is a trick when you add objects (for example Styles or a ViewModelLocator) to App.xaml when it already has merged resource dictionaries. The syntax is a bit convoluted, so here we go:
<Application.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="Skins/Brushes.xaml"/> </ResourceDictionary.MergedDictionaries> <vm:ViewModelLocator x:Key="Locator" d:IsDataSource="True" /> </ResourceDictionary> </Application.Resources>
So yeah, the trick is to put the ViewModelLocator (or any other object for that matter) within the ResourceDictionary tag…
HTH,
Laurent
Original Post: Adding a ViewModelLocator and Merged Dictionaries to App.xaml
The content of the postings is owned by the respective author. Silverlight Feeds is not responsible for the contents of the postings. This site is automatically generated and cannot be reviewed for abusive content. If you find abusive content on Silverlight Feeds, please contact us. Designated trademarks and brands are the property of their respective owners. All rights reserved.