tags:

views:

260

answers:

2

Good afternoon,

does anyone know of a good xhtml to xaml converter library / functionality? All the ones I've found are far from complete, are missing elements of the base xhtml namespace (e.g. tables etc) and what I need is to display valid xhtml in an wpf flowdocument.

Any ideas / suggestions?

Cheers & thanks -Jörg

+2  A: 

If you just need to display existing XHTML, how about using a WebBrowser control? It may require the .NET 3.5 SP1 install if you don't have it yet. You can use the NavigateToString or NavigateToStream that Lester shows off.

<Grid>
 <FlowDocumentReader>
  <FlowDocument>
   <Paragraph>
    Hosting some XHTML.
   </Paragraph>
   <Paragraph>
    <WebBrowser Height="100" x:Name="uiWebBrowser" />
   </Paragraph>
  </FlowDocument>
 </FlowDocumentReader>
</Grid>


public Window1()
{
 InitializeComponent();

 uiWebBrowser.NavigateToString("<b>Stuff</b> Stuff Stuff Stuff <a href=\"http://www.google.com\"&gt;Stuff&lt;/a&gt; Stuff <i>Stuff <h1>stuff</h1><i>");
}
rmoore