This is an old revision of the document!
Resources
Embedding an Application Icon
- Create App.rc:
101 ICON "Application.ico" 102 ICON "Document.ico" 103 ICON "Help.ico"
- Compile:
C:\> rc App.rc
- Add
App.res
to the project (leaveNone
as theBuild Action
). - Build.
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.