?
Solved

WPF C# - what path is  URI point to

Posted on 2013-06-18
5
Medium Priority
?
429 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

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

762 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