= Resources = == Embedding an Application Icon == * Create App.rc: 101 ICON "images\\Application.ico" 102 ICON "images\\Document.ico" 103 ICON "images\\Help.ico" * Compile using Resource Compiler (Visual Studio Command Line):C:\> rc App.rc * Add ''App.res'' to the project (leave ''None'' as the ''Build Action''). * Select icon for project: Project > Properties > Application > Resources: Icon and Manifest. * Build. Source: [[http://stackoverflow.com/questions/1832583/embed-multiple-icons-in-wpf-exe|StackOverflow: Dmitry Schechtman, "Embed multiple icons in WPF EXE"]] == Referencing Resources from an Assembly == In XAML, to reference an image in ''images/icons/icon-product-acme1.png'' in assembly ''Acme.Products.Specifications.dll'', you need to use the ''pack'' notation (for package). Local Assembly (no ''pack'' notation required): Referenced Assembly: NOTE: Make sure the image file is compiled as ''Resource'' (not ''Embedded Resource'' or ''Content'') in the assembly. == Localization using Resources == * See: [[swdev:dotnet:Localization Using RESX Files]] == Resource Dictionary == ==== ResourceDictionary in Application ==== * Create a resource dictionary using XML. Eg: ''Assets\FormDictionary.xaml'': #FFE8EDF9 #FFC5CBF9 #FF7381F9 . . . ==== ResourceDictionary Assembly ==== * Create an assembly project in C#. * Add references to: * ''PresentationCore'' * ''PresentationFramework'' * ''WindowsBase'' * Create a resource dictionary using XML: #FFE8EDF9 #FFC5CBF9 #FF7381F9 . . . ==== Merge ResourceDictionary at Application Scope ==== ''ResourceDictionary'' files can be merged together in ''App.xaml'' so these resource are available for all controls in the application: = References = * [[http://msdn.microsoft.com/en-us/library/aa970069.aspx|MSDN: Pack URIs in WPF]] * [[http://blogs.msdn.com/b/wpfsldesigner/archive/2010/06/03/creating-and-consuming-resource-dictionaries-in-wpf-and-silverlight.aspx|MSDN Blogs: Creating and Consuming Resource Dictionaries in WPF and Silverlight]]