开发者

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:

  1. Project Root Folder: \root
  2. Icon in root folder: \root\AppIcon.ico
  3. Subdirectory: \root\subdirectory
  4. 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'

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜