c# - Custom control library file resources -
i developing custom command includes webbrowser command within command template. creating custom command , accessing webbrowser within command template works without problem have situation onappytemplate method needs dynamically load html file within same custom command library dll. here code using @ moment when seek access file streamresourceinfo null
public override void onapplytemplate() { base.onapplytemplate(); _host = gettemplatechild("part_browserhost") 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 build action file resource or embeddedresource? latter require using getmanifestresourcestream , not pack uri. if resource have verified that right name resource? e.g. looking @ resources of assembly in reflector/ilspy.
c# wpf resources class-library
No comments:
Post a Comment