.NET Framework Developer Center >
.NET Development Forums
>
Windows Presentation Foundation (WPF)
>
WebBrowser as VisualBrush ?
WebBrowser as VisualBrush ?
- HI first :
Hi I try to catch myLoadCompleted event and i can't success any suggestions ?
<Grid> <WebBrowser x:Name="WebBrowserTest" Loaded="WebBrowser_Loaded"LoadCompleted
="wb_LoadCompleted" ClipToBounds="True" /> </Grid></
UserControl>
Code behind :
private void WebBrowser_Loaded(object sender, RoutedEventArgs e){
WebBrowser wb = sender as WebBrowser;
// wb.LoadCompleted +=
new LoadCompletedEventHandler(wb_LoadCompleted);//something i try.
wb.Source = new Uri ( http://www.google.com, UriKind.RelativeOrAbsolute);}
void wb_LoadCompleted(object sender, NavigationEventArgs e){
throw new NotImplementedException(); // also a break point //}
The final use of the WebBrowser in as a resource.
and i can't find the way to use webbrowser as visualbrush ?
Thanks.
Debug your life !. http://epsilone3.spaces.live.com
Answers
- Tim, that's not strictly true. You can use a windows forms web browser as the source of a visual in WPF.
although I suspect it would now be infinately easier using 3.51 than the nasty device context twiddling I did.
more details of the WinForms version is on my blog (its pretty old now and was a proof of concept - putting Virtual Earth on a WPF form) but that should be a lot easier now.
here :
http://rob.runtothehills.org/archives/60
I was meaning to do the same with 3.51, but just don't have the time at the moment! :(
cheers
Rob
--Rob :::::: Visit -> http://rob.runtothehills.org- Proposed As Answer byMarco Zhou Tuesday, August 26, 2008 10:00 AM
- Marked As Answer byMarco Zhou Wednesday, August 27, 2008 10:33 AM
All Replies
- A WebBrowser hosts an HWND. You can't use it as the source for a Visual Brush.
Controls for WPF and Windows Forms at http://www.divelements.co.uk - So if use the webbrowser from the netframe 3.5 sp1 , does it still can't be display inside a visualbrush ?.
Debug your life !. http://epsilone3.spaces.live.com- Edited byEpsilone3 Thursday, August 21, 2008 9:30 PMlokm
- Tim, that's not strictly true. You can use a windows forms web browser as the source of a visual in WPF.
although I suspect it would now be infinately easier using 3.51 than the nasty device context twiddling I did.
more details of the WinForms version is on my blog (its pretty old now and was a proof of concept - putting Virtual Earth on a WPF form) but that should be a lot easier now.
here :
http://rob.runtothehills.org/archives/60
I was meaning to do the same with 3.51, but just don't have the time at the moment! :(
cheers
Rob
--Rob :::::: Visit -> http://rob.runtothehills.org- Proposed As Answer byMarco Zhou Tuesday, August 26, 2008 10:00 AM
- Marked As Answer byMarco Zhou Wednesday, August 27, 2008 10:33 AM
- Trying to :
<Grid Name="GridVisualBrush" ClipToBounds="True"> <Grid.Background> <VisualBrush> <VisualBrush.Visual> <WebBrowser Source ="http://www.msn.com"/> </VisualBrush.Visual> </VisualBrush> </Grid.Background> </Grid>
With no luck.
Any suggestion guys ?
Debug your life !. http://epsilone3.spaces.live.com - Hi Epsilone3,
I've just tried a quick example project with a web browser control from 3.5sp1 and it doesn't seem to want to be uses as the source for a visual brush at all. No amount of fiddling calling refresh methods etc will get it to show up.
I suspect that there's some wpf trickery going on behind the scenes here and it's still just a winforms browser in WPF clothing.
unless of course, any of the MS guys know better ;)
cheers,
Rob
--Rob :::::: Visit -> http://rob.runtothehills.org - I think this is a good example of why decent DWM access would be so powerful. If we could use a DWM texture as a VisualBrush, we could surely do some cool stuff with Win32 (hWnd) controls.
-Jer
- Hi, I would like to retrun to the first question - me too can't get the LoadCompleted event. Anybody knows the answer? Or is it a bug?
Thanks!
Jan

