开发者

How do I refer to root project directory in WPF XAML when setting paths to other files?

开发者 https://www.devze.com 2023-01-17 22:54 出处:网络
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 th

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

精彩评论

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