Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set a WPF image source without writing the assembly name?

Normally a WPF Image source is something like

WpfApplication1;component/Untitled.png

But what if I have to rename the assembly? I have to change all Image sources?

like image 515
Jader Dias Avatar asked Feb 04 '11 16:02

Jader Dias


1 Answers

You can use relative paths:

(1). Relative to the project:

<Image Source="/Untitled.png".../>

(2). Relative to the XAML file path where this element is defined:

<Image Source="Untitled.png".../>

But, if the image is located in an external assembly then you have to specify the assembly name, otherwise there is no way WPF can find it.

like image 186
Pavlo Glazkov Avatar answered Sep 21 '22 14:09

Pavlo Glazkov