设置资源字典的来源时无法识别 URI 前缀

afa*_*lek 4 c# wpf uri resourcedictionary

URI 前缀无法识别

我在System.NotSupportedException.

此行用于设置 a 的来源ResourceDictionary

view.Source = new Uri("/DA.EasyTeach.Math;component/View.xaml", UriKind.RelativeOrAbsolute);
Run Code Online (Sandbox Code Playgroud)

这是我的文件结构的片段:
在此处输入图片说明

View.xaml具有生成操作资源

Jan*_*ník 6

我有一个混合应用程序 WinForms + WPF,原因是System.Windows.Application.Current == null. 基于这个问题,我通过在创建字典 Uri 之前运行以下行来解决它:

new System.Windows.Application();
Run Code Online (Sandbox Code Playgroud)