Reputation:
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
Upvotes: 0
Views: 983
Reputation: 11183
How about HTML to XAML converter?
http://svn.assembla.com/svn/rsstoblog/Source/Common/HtmlToXamlConverter.cs
and
http://msdn.microsoft.com/en-us/library/aa972129.aspx
Upvotes: 0
Reputation: 15393
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\">Stuff</a> Stuff <i>Stuff <h1>stuff</h1><i>");
}
Upvotes: 2