Useful Tip: Solution for known issue with Merged Dictionaries in App.xaml (VS 2010 RTM)

23 באפריל 2010

At last days many .Net developers upgraded their Visual Studio to RTM 2010. There are some “Known Issues” in this release.
After painful upgrade we discovered problem in our WPF project: Some Dynamic Resources from Merged Dictionaries that referenced in App.xaml stopped working (although this code worked without any problems in Beta-2).
We found some workaround: Add some style without specific key for unused element in Resource Dictionary and this will trigger WPF to load resources from Merged Dictionaries.


<Application x:Class="SomeNamespace.App"
                        <ResourceDictionary Source="/SomeNamespace;Component/Styles.xaml"/>
                        <ResourceDictionary Source="/SomeNamespace;Component/Brushes.xaml"/>

                  <Style TargetType="{x:Type Line}"/>

In yellow: Merged Dictionaries.
In green: Dummy Style as Trigger.

Enjoy 😉

Remarks: Any comments/improvements will be accepted with pleasure. Of course, you must understand that this code is a contribution and I’m not responsible for any damage that may be caused by using it. All rights reserved ®.

Add comment
facebook linkedin twitter email

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>