Table of Contents

Resources
Embedding an Application Icon

Source: 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):

<Image Source="/images/icons/icon-product-acme1.png" Width="35" Height="35" Margin="5" />

Referenced Assembly:

<Image Source="pack://application:,,,/Acme.Products.Specifications;component/images/icons/icon-product-acme1.png" Width="35" Height="35" Margin="5" />

NOTE: Make sure the image file is compiled as Resource (not Embedded Resource or Content) in the assembly.

Localization using Resources
Resource Dictionary

ResourceDictionary in Application

ResourceDictionary Assembly

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:

<Application 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    x:Class="MyApp">
    <Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="Assets/FormDictionary.xaml" />
                <ResourceDictionary Source="AHI.App.Resources;component/MainDictionary.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Application.Resources>
</Application>
References