WPF: NotSupportedException: The URI prefix is not recognized.
WPF: NotSupportedException: The URI prefix is not recognized.
1.如果你有MyWindow的源代码,添加前缀pack://application:,,,
1 |
_dictionary.Source = new Uri("pack://application:,,,/RibbonControlsLibrary;component/Themes/RibbonWindow.xaml", UriKind.Relative); |
2.如果MyWindow是第三方提供的,你就需要在new MyWindow()之前加上下面的语句:
1 |
System.Windows.Application app = new System.Windows.Application(); |
分析Applicaiton的源代码其实就会发现,在它的静态构造函数中有下面的代码: