Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

WPF C# - what path is  URI point to

Posted on 2013-06-18
5
Medium Priority
?
437 Views
Last Modified: 2013-07-04
new ImageBrush(new BitmapImage(new Uri(BaseUriHelper.GetBaseUri(this), "Images/icon.png")))

Where should I put the icon.png?

I thought I should put the icon.png into /application/Images/icon.png where the application (Executeable) is running from /application
0
Comment
Question by:tommym121
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 

Author Comment

by:tommym121
ID: 39259448
This is my line

            Brush brsh = new ImageBrush(new BitmapImage(new Uri("Images//WLM-icon.png")));
It cause an exception on Uri()


            new Uri("Images//WLM-icon.png")      This expression causes side effects and will not be evaluated      System.Uri


I put the image file in this directory
C:\Users\user1\Documents\Visual Studio 2010\Projects\TestWPF\TestWPF\bin\Debug\Images

I am not sure what"s go wrong.  Can someone help?
0
 
LVL 13

Accepted Solution

by:
jonnidip earned 2000 total points
ID: 39290130
You better create a Solution Folder (for example: "Icons") in your project and put your images there.
You may then reach your folder this way:
new Uri("pack://application:,,,/<yourProjectName>;component/Icons/WLM-icon.png")

Open in new window


I hope this helps.

Regards.
0
 

Author Closing Comment

by:tommym121
ID: 39300372
Thanks
0
 
LVL 13

Expert Comment

by:jonnidip
ID: 39300385
You're welcome!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question