I'm working on a Version History dialog box, and I created a sample to test it. It seems, however, that the sample can't find the HTML file:
var dlg = new VersionHistoryDialog();
var uri = new Uri(@"pack://application:,,,/VersionHistory.html", UriKind.Absolute);
var source = Application.GetResourceStream(uri).Stream; // This line throws the error
dlg.Stream = source;
var result = dlg.ShowDialog();
label1.Content = result;
That line in the code above throws this error:
System.IO.IOException was unhandled
Message=Cannot locate resource 'versionhistory.html'.
Source=PresentationFramework
StackTrace:
at MS.Internal.AppModel.ResourcePart.GetStreamCore(FileMode mode, FileAccess access)
at System.IO.Packaging.PackagePart.GetStream(FileMode mode, FileAccess access)
at System.IO.Packaging.PackagePart.GetStream()
at System.Windows.Application.GetResourceStream(Uri uriResource)
....
So.... what do I do? The file is named "VersionHistory.html
" and its in the same folder ("Views") as the xaml.cs
file asking for it.