I am developing custom control which includes WebBrowser control inside its control template. creating custom control and accessing WebBrowser inside control template works without any problem but I have a situation where OnAppyTemplate method needs to dynamically load HTML file which is inside same custom control library DLL. here is the code I am using at the moment but when I try to access file streamResourceInfo is always null
public override void OnApplyTemplate()
{
base.OnApplyTemplate();
_host = GetTemplateChild("PART_BrowserHost") as WebBrowser;
if (_host == null) return;
_host.LoadCompleted += HostOnLoadCompleted;
var uri = new Uri(@"pack://application:,,,/Taicodev.Shark.Controls;component/EpubReader/Resources/Book.html", UriKind.Absolute);
var streamResourceInfo = Application.GetContentStream(uri);
var source = streamResourceInfo.Stream;
_host.NavigateToStream(source);
}
Is the build action for the file Resource or is it EmbeddedResource? The latter would require using GetManifestResourceStream and not a pack Uri. If it is a Resource have you verified that that is the correct name for the resource? E.g. looking at the resources of that assembly in reflector/ilspy.