System.Windows.Application.GetResourceStream返回null

时间:2010-01-26 19:29:59

标签: c# wpf resources

如果我使用Catalog.xaml作为内容调试WPF应用程序,我无法获取它的资源流 - GetResourceStream返回null:

var uri = new Uri("/Assembly;component/Catalog.xaml", UriKind.Relative);
var foo = System.Windows.Application.GetResourceStream(uri);

foo为null。我做错了什么?

1 个答案:

答案 0 :(得分:0)

我相信类型内容你只需要项目名称:

var uri = new Uri(**"Catalog.xaml"**, UriKind.Relative);
var foo = System.Windows.Application.GetResourceStream(uri);