Merged resource dictionaries


One of my favorite new features in the September CTP is merged dictionaries — you can use these to put resources in a separate file from the rest of your xaml.  Nathan gives a great overview of this feature in http://www.designerslove.net/2005/09/resourcedictionaries-use-em.html.


Comments (1)

  1. Keith Patrick says:

    Something he left off there (I can’t post on his blog) is that the merging can also occur across assemblies. The documentation shows a brief example in a note about September changes, but doesn’t elaborate much on it, but basically, so long as you format it like so:

    <ResourceDictionary Source="<assembly>;component/<path>/MyResourceDictionary.xaml"/>

    It’ll merge in. Only catch: right now, you can’t refer to a style by name within the external RD (so you can store a base style and derive off it in the same external assembly); subclassing across the assemblies or all in the local one do work, though. The prob is that the {StaticResource …} gets resolved to an System.Object rather than a System.Windows.Style.