There are two ways to show HTML content in a WPF window using Frame or WebBrowser control. If you want to switch between WPF and HTML content seamlessly the Frame control is a better choice for you. If you need more control over HTML content, examine the object model of the page and/or monitor page navigation you should consider the WebBrowser control. Both these controls show standard Internet Explorer window with all additional features like JavaScript, Dynamic HTML, ActiveX controls.
XAML version:
1: <Grid x:Name="grid">
2: <Frame Source="http://bbc.co.uk" />
3: <!--or-->
4: <WebBrowser Source="http://bbc.co.uk"/>
5: </Grid>
C# version:
1: Frame frame = new Frame();
2: grid.Children.Add(frame);
3: frame.Navigate(new Uri("http://bbc.co.uk"));
4:
5: //or
6:
7: WebBrowser browser = new WebBrowser();
8: grid.Children.Add(browser);
9: browser.Navigate(new Uri("http://bbc.co.uk"));
Useful links:
Thank you, Simple and easy
ReplyDelete