我有一個圖片String myimg = "images.jpg";
,我想設置像一個ImageStream
到mediaHistoryItem
的ImageStream來源
我試過這段代碼:
if (mediaHistoryItem.ImageStream == null)
{
StreamResourceInfo sri = Application.GetResourceStream(new Uri("real.jpg", UriKind.Relative));
Stream stream = sri.Stream;
mediaHistoryItem.ImageStream = stream;
}
,但它給我的異常NullreferenceException
。
那麼,什麼是空的。你是否檢查哪條線給你例外? – Vale