Thanks! Yeah, under the hood the WebBrowser control uses Win32, so the WPF visual tree can't get to it and RenderTargetBitmap won't work. Fortunately, in another context I had to do exactly what you are trying to do. It is possible to get
a screenshot of the WebBrowser control via GDI. You need to reference System.Drawing and then you can do something like this:
In this case "myUserControl" would be the WPF User Control that contains the WebBrowser.
Rect bounds = VisualTreeHelper.GetDescendantBounds(myUserControl);
System.Windows.Point p0 = myUserControl.PointToScreen(bounds.TopLeft);
System.Drawing.Point p1 = new System.Drawing.Point((int)p0.X, (int)p0.Y);
System.Drawing.Bitmap image = new System.Drawing.Bitmap((int)bounds.Width, (int)bounds.Height);
System.Drawing.Graphics imgGraphics = System.Drawing.Graphics.FromImage(image);
imgGraphics.CopyFromScreen(p1.X, p1.Y, 0, 0, new System.Drawing.Size((int)bounds.Width, (int)bounds.Height));
You can then save image to a MemoryStream and stuff it into the ImageButtons on the ContentTabView or on the FabTabItem ToolTip. So this sort of thing would go into the codebehind for ContentTabView in the FabTab source.
There are some um, "challenges" to doing it this way though. GDI captures can show other overlapping windows, for instance a Windows Live Messenger notification that pops up and overlaps the WebBrowser, then that notification popup can sometimes
be part of the screenshot. Also, with the WebBrowser some web pages can take a while to completely load, so if the user changes the selected tab before the webpage completely renders the HTML content then the screenshot held in memory for that WebBrowser
will not exactly mirror the way it looks once it's fully rendered. So these quirks can be managed and are not showstoppers, but I thought I'd make you aware of them.
Incidentally this is a pretty specific thing you are trying to do--I don't think I will be adding a dependency on System.Drawing to FabTab or adding some of these GDI quirks to handle this case that you are dealing with. But the beauty of open source
is that you can do this yourself to the source and get the functionality.
Please let me know how it goes. There may be other ways besides using GDI, but as I said, I know you can get it working in that way. Luckily almost all the changes you'd have to make would be to the one FabTab source file.