Finally bit the bullet and replaced my hack for displaying PDF content inside a silverlight app with a proper SL5 Trusted In-Browser WebBrowser that navigates to a .pdf.
When i try to RE-navigate the WebBrowser to another PDF I am seeing the error "Trying to revoke a drop target that has not been registered (Exception from HRESULT: 0x80040100)"
This only happens when I deploy to IIS (localhost IIS and another server IIS 7.5) ... NOT while running in VS2010.
Details:
UI is extremely simple. 1 Grid w/ 2 columns:
Column 1 Column2
======== ====================================================================
Treeview <WebBrowser x:Name="ContentWebBrowser" Grid.Column="1"></WebBrowser>
When user selects an item in the treeview, I simply call:
Uri serverUri = new Uri(string.Format("http://{0}:{1}/",
Application.Current.Host.Source.DnsSafeHost,
Application.Current.Host.Source.Port));
var relative= "/Content/x/y/z.pdf"; //This is dynamiclly pulled from Treeview, EDITED FOR SO
Uri relativeUri = new Uri(relative, UriKind.Relative);
ContentWebBrowser.Navigate(new Uri(serverUri, relativeUri));
With Cassini running silverlight both w/ and w/o debugger via VS2010 i can Select item after item in my list view and my WebBrowser will "re-navigate" calling this same code above. BUT, once i deploy to my local iis, any time i end up calling Navigate for the 2nd time I am getting this error:
System.Exception: Trying to revoke a drop target that has not been registered (Exception from HRESULT: 0x80040100)
at MS.Internal.XcpImports.CheckHResult(UInt32 hr)
at MS.Internal.XcpImports.WebBrowser_Navigate(DependencyObject obj, Uri source)
at System.Windows.Controls.WebBrowser.Navigate(Uri source)
at SystemUtilities.Views.WebContentListView.TreeViewItem_Selected(Object sender, RoutedEventArgs e)
Other oddities: Sometimes i can "re-navigate" 3 or 4 times before i see this exception. Sometimes when i load another page in my SL application this error gets thrown. Happens whether PDF is cached or not cached when I load it into the WebBrowser. If i display standard html or an image instead of a PDF this does not happen.
Edit: I added logic to check to make sure LoadCompleted event fires before i try to re-navigate the WebBrowser but it does not seem to matter. (not 100% sure but i think that it ignores the fact that the PDF might still be loading and just signals that the DOM is ready). Although, even if I want a long time (30 seconds) after it looks like the 1st pdf is done loading, i still get the error.
Any suggestions?
New I posted my sample on skydrive.. check out the readme in order to repro!: http://sdrv.ms/JSn1KB
User contributions licensed under CC BY-SA 3.0