Solved

WPF C# - what path is  URI point to

Posted on 2013-06-18
5
427 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 500 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

728 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