I'm moving a WPF application from VS 2010 to VS 2012.
I have a main executable which contains the App.xaml and a separate class library for all the WPF stuff. In VS2012 (SP3) the XAML designer does not show any styles which are in a MergedResourceDictionary defined in App.xaml, VS 2010 does...
For testing purposes I moved App.xaml to my class library. After that the VS 2012 designer showed everything correctly.
Since class libraries cannot contain an App.xaml this is not a solution.
Any ideas?
My App.xaml looks like the following:
<Application x:Class="MyApplication.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Startup="AppStartup">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/OtherAssemblyName;component/Resources/Resource1.xaml" />
<ResourceDictionary Source="pack://application:,,,/OtherAssemblyName;component/Resources/Resource2.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
Know this is an old question, but answering it for anyone who may face something similar in the future.
The safest way to accomplish this is to create a new ResourceDictionary file, and add the MergedResourceDictionaries in it.
Then reference that ResourceDictionary in your user control/pages/windows - all of them, since the
<UserControl.Resources>
<ResourceDictionary Source="GlobalResources.xaml" />
<UserControl.Resources>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.