9

I have a solution under which so many WPF applications and class library projects are there. I want to use icon in another project which is under Resources folder in other WPF application. how can I achieve this ? I do not want to copy same images over and over in all different projects.

2 Answers 2

10

Use pack URI syntax to refer resources. Somethning like this:

<Image Source="pack://application:,,,/Another.Assembly.Name;component/PathToResourceInAnotherProject/YourImage.png"/> 
Sign up to request clarification or add additional context in comments.

Comments

7

Yes,Microsoft makes that possible for you, as long as Project ABC has a reference to Project XYZ.

<ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="/Project XYZ;component/YourSubFolder/YourResourceFile.xaml" /> </ResourceDictionary.MergedDictionaries> 

Then you can just use the Resources defined in YourResourceFile.xaml.

3 Comments

It works as per your suggestion! I want to try something more and let you know what I want to achieve is possible or not
Shouldn't it be /Project XYZ; as per your above statement
Well it should be but I understand the what he wants to tell me :)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.