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

Accessing image from Resource File in XAML markup

Rate me:
Please Sign up or sign in to vote.
3.86/5 (7 votes)
9 Mar 2011CPOL 76.8K   3   3
Accessing image from Resource File in XAML markup
Suppose we have an image in our Resource file named as LeftBaseTriangle.bmp.

In order to access it via XAML, all we need is to add a reference to project properties like below:
XML
xmlns:properties="clr-namespace:Azad.Modules.MyProject.Properties"


and add the following code:

XML
<image source="{Binding Source={x:Static properties:Resources.LeftBaseTriangle}}" />

License

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


Written By
Software Developer (Senior) Vizrt Bangladesh
Bangladesh Bangladesh
I am truly versatile and 360 degree Engineer having wide range of development experience in .NET and Java Platform. I am also proficient in system level programming in C++. To me technology is not at all a problem, it’s the client requirement that matters! That is I am ready and comfortable to use any technology to make the business of my client a success.

In my five years of experience I have the opportunities to work for fortune 500 companies of US and many renowned clients from Europe.

My Linkedin Profile: http://bd.linkedin.com/in/mahmudazad

Comments and Discussions

 
GeneralMy vote of 1 Pin
Karel Kral27-Jun-18 21:54
Karel Kral27-Jun-18 21:54 
QuestionNot working Pin
mikefulton8-Apr-15 12:32
mikefulton8-Apr-15 12:32 
AnswerRe: Not working Pin
Ollikat7-Jul-16 0:35
Ollikat7-Jul-16 0:35 

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.