C# – System.Windows.Application.GetResourceStream returns null

cresourceswpf

If I debug a WPF-application with Catalog.xaml as Content, I can't get the resource stream of it – GetResourceStream returns null:


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

foo is null. What am I doing wrong?

Best Answer

I believe for type Content you only need the item name:

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