Click here to Skip to main content
15,888,461 members
Home / Discussions / C#
   

C#

 
QuestionAppDomain.CurrentDomain.SetData(SOME_SECRET_KEY, PrivateKey) [modified] Pin
devvvy1-Mar-11 22:53
devvvy1-Mar-11 22:53 
QuestionAssembly.GetExecutingAssembly - can we get "Key" which signed the assembly? Pin
devvvy1-Mar-11 22:49
devvvy1-Mar-11 22:49 
AnswerRe: Assembly.GetExecutingAssembly - can we get "Key" which signed the assembly? Pin
Keith Barrow1-Mar-11 23:23
professionalKeith Barrow1-Mar-11 23:23 
GeneralRe: Assembly.GetExecutingAssembly - can we get "Key" which signed the assembly? [modified] Pin
devvvy2-Mar-11 16:08
devvvy2-Mar-11 16:08 
QuestionHow to block read / write operation of cd/dvd [modified] Pin
Aisha sharma1-Mar-11 22:24
Aisha sharma1-Mar-11 22:24 
AnswerRe: How to block read / write operation of cd/dvd Pin
Keith Barrow1-Mar-11 22:55
professionalKeith Barrow1-Mar-11 22:55 
AnswerRe: How to block read / write operation of cd/dvd Pin
Dalek Dave7-Mar-11 11:22
professionalDalek Dave7-Mar-11 11:22 
QuestionLoad picture from resource file with XAML Pin
Mc_Topaz1-Mar-11 21:25
Mc_Topaz1-Mar-11 21:25 
I would like to display a picture in my WPF application, where the picture is loaded from a resource file. I'm not interesting doing this with C# code, only with XAML code. But I have no idéa how to pull this off. Please help me.

This is what I have done:

1) Created a new WPF application called: WpfApplication1
2) Created a resource file called: Pictures.resx
3) Added the picture into the resource file
4) The picture is called: CELabel, in the resoruce file explorer window
5) Automatically a folder in in my application is created, called Resources, containing the picture: CELabel.png

Now I would like to code the appropriate XAML code to display the picture. So I try this:

<Window x:Class="WpfApplication1.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525">
    <Grid>
        <Image Source="/Pictures/CELabel.png"></Image>
    </Grid>
</Window>


And of course the damn compiler results in an error:
Could not find a part of the path 'C:\Pictures\CELabel.png'

Yes, of course the resource file is not recognizable in the XMAL editor and then my picture cannot be loaded.
How do I pull this off? I'm sure this is rediculious easy when knowing how...
AnswerRe: Load picture from resource file with XAML Pin
Pete O'Hanlon1-Mar-11 21:31
mvePete O'Hanlon1-Mar-11 21:31 
GeneralRe: Load picture from resource file with XAML Pin
Mc_Topaz1-Mar-11 21:36
Mc_Topaz1-Mar-11 21:36 
AnswerRe: Load picture from resource file with XAML Pin
ltuljo2-Mar-11 14:46
ltuljo2-Mar-11 14:46 
QuestionPostgres database connection Pin
Software20071-Mar-11 9:32
Software20071-Mar-11 9:32 
AnswerRe: Postgres database connection Pin
Orcun Iyigun1-Mar-11 9:38
Orcun Iyigun1-Mar-11 9:38 
GeneralRe: Postgres database connection Pin
Software20071-Mar-11 9:45
Software20071-Mar-11 9:45 
GeneralRe: Postgres database connection Pin
Dave Kreskowiak1-Mar-11 9:46
mveDave Kreskowiak1-Mar-11 9:46 
AnswerRe: Postgres database connection Pin
Dave Kreskowiak1-Mar-11 9:45
mveDave Kreskowiak1-Mar-11 9:45 
GeneralRe: Postgres database connection Pin
Software20071-Mar-11 9:56
Software20071-Mar-11 9:56 
AnswerRe: Postgres database connection Pin
Pete O'Hanlon1-Mar-11 9:56
mvePete O'Hanlon1-Mar-11 9:56 
GeneralRe: Postgres database connection Pin
Software20071-Mar-11 10:26
Software20071-Mar-11 10:26 
GeneralRe: Postgres database connection Pin
Pete O'Hanlon1-Mar-11 10:34
mvePete O'Hanlon1-Mar-11 10:34 
GeneralRe: Postgres database connection Pin
Software20071-Mar-11 10:40
Software20071-Mar-11 10:40 
AnswerRe: Postgres database connection Pin
PIEBALDconsult1-Mar-11 13:55
mvePIEBALDconsult1-Mar-11 13:55 
QuestionFile.Move() method Pin
Orcun Iyigun1-Mar-11 9:30
Orcun Iyigun1-Mar-11 9:30 
AnswerRe: File.Move() method Pin
Dave Kreskowiak1-Mar-11 9:39
mveDave Kreskowiak1-Mar-11 9:39 
GeneralRe: File.Move() method Pin
Orcun Iyigun1-Mar-11 10:05
Orcun Iyigun1-Mar-11 10:05 

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.