无效的URI:无法确定URI的格式 - C#

use*_*195 4 c#

我试图将c#中的资源字典的源设置为项目中文件夹的位置,但是得到上述错误.

有人可以建议问题是什么吗?

下面是代码:

myResourceDictionary.Source = new Uri("../Resources/Styles/Shared.xaml");
Run Code Online (Sandbox Code Playgroud)

如果您需要更多信息,请告诉我.

Mag*_*son 9

你必须使用 UriKind.Relative

myResourceDictionary.Source = new Uri("../Resources/Styles/Shared.xaml",  UriKind.Relative);
Run Code Online (Sandbox Code Playgroud)