This library provides seamless conversion capabilities between HTML and XAML markup languages, enabling developers to effortlessly translate web content into native XAML format for integration within .NET applications, and vice versa.
$ dotnet add package MyNet.Xaml.Html
XAML to HTML conversion utilities and helpers for cross-platform content rendering in .NET applications.
Install via NuGet:
dotnet add package MyNet.Xaml.Html
using MyNet.Xaml.Html;
// Convert XAML string to HTML
string xamlContent = "<TextBlock>Hello World</TextBlock>";
string htmlContent = XamlToHtmlConverter.Convert(xamlContent);
// Convert a WPF FlowDocument to HTML
FlowDocument document = new FlowDocument();
document.Blocks.Add(new Paragraph(new Run("Sample text")));
string html = XamlToHtmlConverter.ConvertFlowDocument(document);
var options = new ConversionOptions
{
PreserveWhitespace = true,
IncludeStyles = true,
CustomCssClasses = new Dictionary<string, string>()
};
string html = XamlToHtmlConverter.Convert(xamlContent, options);
This package is part of the MyWpf collection:
Contributions are welcome! Please see the Contributing Guidelines for more information.
Copyright © 2016-2025 Stéphane ANDRE.
MyNet.Xaml.Html is provided as-is under the MIT license. For more information see LICENSE.