Click here to Skip to main content
15,881,559 members
Articles / Desktop Programming / WPF
Tip/Trick

Load external images in WPF via XAML ?

Rate me:
Please Sign up or sign in to vote.
5.00/5 (2 votes)
19 Apr 2010CPOL 29.9K   8   3
Sometimes we need to show an external image directly in WPF.Assume we have a folder that is named images beside of our main's WPF exe file. There is an image in this folder that's named sample.png.Now with the following XAML code, we can show it in WPF directly:<Image...
Sometimes we need to show an external image directly in WPF.
Assume we have a folder that is named images beside of our main's WPF exe file. There is an image in this folder that's named sample.png.
Now with the following XAML code, we can show it in WPF directly:

XML
<Image Source="pack://siteoforigin:,,,/images/sample.png" />

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Iran (Islamic Republic of) Iran (Islamic Republic of)
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
QuestionDidn't load any external image Pin
liordino10-Sep-12 9:51
liordino10-Sep-12 9:51 
AnswerRe: Didn't load any external image Pin
Mohammad Dayyan27-Sep-12 2:27
Mohammad Dayyan27-Sep-12 2:27 
QuestionNo Comment Pin
idzodzo25-Jun-12 23:43
idzodzo25-Jun-12 23:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.