[wpf][xaml]Image Trouble
[wpf][xaml]Image Trouble
[wpf][xaml]Image Trouble
[wpf][xaml]Image Trouble
[wpf][xaml]Image Trouble
[wpf][xaml]Image Trouble [wpf][xaml]Image Trouble [wpf][xaml]Image Trouble [wpf][xaml]Image Trouble [wpf][xaml]Image Trouble [wpf][xaml]Image Trouble [wpf][xaml]Image Trouble [wpf][xaml]Image Trouble
[wpf][xaml]Image Trouble [wpf][xaml]Image Trouble
[wpf][xaml]Image Trouble
Go Back  Xtreme Visual Basic Talk > > > [wpf][xaml]Image Trouble


Reply
 
Thread Tools Display Modes
  #1  
Old 12-24-2013, 09:08 AM
JeremyBenson11 JeremyBenson11 is offline
Regular
 
Join Date: Dec 2013
Posts: 50
Default [wpf][xaml]Image Trouble


hey,

I'm having some trouble getting images on a menuitem. I added the images through a Resource file and set the build method to resource. All images are pngs in my Resource file. The images show up in the editor, but when I run the app with the play button they don't show up in the app.

xaml code is

Code:
<MenuItem Header="_Undo">
                        <MenuItem.Icon>
                            <Image Source="Pack://application,,,Water SV1;compenent/Resources/Undo.png"></Image>
                        </MenuItem.Icon>
                    </MenuItem>
Thanks in advanced
Reply With Quote
  #2  
Old 12-24-2013, 04:03 PM
PlausiblyDamp's Avatar
PlausiblyDamp[wpf][xaml]Image Trouble PlausiblyDamp is offline
Ultimate Contributor

Forum Leader
* Expert *
 
Join Date: Nov 2003
Location: Newport, Wales
Posts: 2,058
Default

Is the XAML you posted a copy and paste of what you are using in your application or have you retyped it?

If it is a copy and paste job then there are a couple of issues...

the format of the uri should include a slash before the referenced assembly name and the spelling of component in your code is wrong.

Try
Code:
<MenuItem Header="_Undo">
                        <MenuItem.Icon>
                            <Image Source="Pack://application,,,/Water SV1;component/Resources/Undo.png"></Image>
                        </MenuItem.Icon>
                    </MenuItem>
and see if that helps.
__________________
Intellectuals solve problems; geniuses prevent them.
-- Albert Einstein

Posting Guidelines Forum Rules Use the code tags
Reply With Quote
  #3  
Old 12-24-2013, 08:10 PM
JeremyBenson11 JeremyBenson11 is offline
Regular
 
Join Date: Dec 2013
Posts: 50
Default

Hey,

Thanks Plausibly

that was definitely a direct cut and paste. I tried the fix, but it didn't go... I tried on another section of code, but it's all set up the same. Here's the part of code I tried it on.

Code:
<MenuItem Header="_New File">
                        <MenuItem.Icon>
                            <Image Source="Pack://application,,,/Water SV1;component/Resources/NewFile.png"></Image>
                        </MenuItem.Icon>
                    </MenuItem>
Another thing I might need to mention is that I didn't reference my resource file anywhere in this xmal document. I'm not sure how, or if that's a necessary step. If it is where does the reference go, right after the first window tag?

Also how is a reference made if one is needed?

You and I think AtmaWeapon or UltimaWeapon used to help me under another name NewVBProgrammer. I had to sign in as a new name though because I forgot my old password.

Oh and since then I learned about classes and all that, lol...

some 40 books later across C++ lol

still hard though, lol
Reply With Quote
  #4  
Old 12-24-2013, 08:43 PM
JeremyBenson11 JeremyBenson11 is offline
Regular
 
Join Date: Dec 2013
Posts: 50
Default

Hey, I got it

I'll explain for anyone that's having the same problem. All I had to do was select the image tag in the xaml.

Code:
<Image Source="Pack://application,,,/Water SV1;component/Resources/NewFile.png"></Image>
Now in the properties tray in the right hand side there's a drop down labelled source. I had to select the source in there...it reverted my code back to the simpler method

Code:
<Image Source="Resources/NewFile.png"></Image>
but the funny thing is I had tried that first... The only reason this worked is because I went through the property method in the solution explorer there... Not sure why...maybe a bug in VS?
Reply With Quote
  #5  
Old 12-24-2013, 08:55 PM
JeremyBenson11 JeremyBenson11 is offline
Regular
 
Join Date: Dec 2013
Posts: 50
Default

Shoot, made a double post, not sure why the first posts didn't launch to the post. Anyway, hope the above helps anyone with the same problem
Reply With Quote
Reply

Tags
wpf, xaml


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
[wpf][xaml]Image Trouble
[wpf][xaml]Image Trouble
[wpf][xaml]Image Trouble [wpf][xaml]Image Trouble
[wpf][xaml]Image Trouble
[wpf][xaml]Image Trouble
[wpf][xaml]Image Trouble [wpf][xaml]Image Trouble [wpf][xaml]Image Trouble [wpf][xaml]Image Trouble [wpf][xaml]Image Trouble [wpf][xaml]Image Trouble [wpf][xaml]Image Trouble
[wpf][xaml]Image Trouble
[wpf][xaml]Image Trouble
 
[wpf][xaml]Image Trouble
[wpf][xaml]Image Trouble
 
-->