How do I refer to root project directory in WPF XAML when setting paths to other files?
I'm having issues referring to image files and other XAML files when the files are in a higher level directory then the XAML file from which I am referring to them from. Is there a way to refer to the root of the project directory?
For example I have the following files & directories:
- Project Root Folder: \root
- Icon in root folder: \root\AppIcon.ico
- Subdirectory: \root\subdirectory
- Xaml file 'window.xaml' in subdirectory: \root\subdirectory\window.xaml
How do I refer to \root\AppIcon.ico in the xaml of \root\subdirectory\window.xaml? If I want to set the icon of window window.xaml i should put what here: icon="what开发者_StackOverflow do I put here"?
Thanks
try ..\appicon.ico
to come up by one level. add as many as u need depending on the folder nesting
Actually, if you use ..\
more than one time, it will consider address as the URI and throw an exception:
...operation failed with URI '.. \ ..\application.ico'
精彩评论