anon
anon

Reputation:

Convert XHTML to XAML?

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

Answers (2)

rmoore
rmoore

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

Related Questions