Jan 19, 2009

WebBrowser in WPF

Sketching a very simple RSS reader for a demo today, I just faced the question on how to display HTML in the Windows Forms WebBrowser control in a WPF application.

You just need to wrap it into a WindowsFormsHost element:

<DockPanel Grid.Column="1" Margin="10" TextBlock.FontFamily="Verdana" >

    <TextBlock FontSize="16" FontWeight="Bold" x:Name="RssTitle" DockPanel.Dock="Top"/>


        <wf:WebBrowser x:Name="RssBrowser" />



Setting the namespace for wf to


and then call

this.RssBrowser.DocumentText = syndicationItem.Summary.Text;

from code. Does anybode know how to set the font family, by the way?

No comments:

Post a Comment