Reputation: 13
I have a picture String myimg = "images.jpg";
and I want to set like a ImageStream
to mediaHistoryItem
I tried this code:
if (mediaHistoryItem.ImageStream == null)
{
StreamResourceInfo sri = Application.GetResourceStream(new Uri("real.jpg", UriKind.Relative));
Stream stream = sri.Stream;
mediaHistoryItem.ImageStream = stream;
}
but it give me exception NullreferenceException
.
Upvotes: 1
Views: 965
Reputation: 1024
make sure your picture: real.jpg 's properties:build action is "content" And FilePath is right.
If your image's build action is "resource" you should use path: [projectName];component/real.jpg
Upvotes: 3