OfficeIMO.MarkdownRenderer.Wpf 0.1.3

Prefix Reserved
dotnet add package OfficeIMO.MarkdownRenderer.Wpf --version 0.1.3
                    
NuGet\Install-Package OfficeIMO.MarkdownRenderer.Wpf -Version 0.1.3
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="OfficeIMO.MarkdownRenderer.Wpf" Version="0.1.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="OfficeIMO.MarkdownRenderer.Wpf" Version="0.1.3" />
                    
Directory.Packages.props
<PackageReference Include="OfficeIMO.MarkdownRenderer.Wpf" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add OfficeIMO.MarkdownRenderer.Wpf --version 0.1.3
                    
#r "nuget: OfficeIMO.MarkdownRenderer.Wpf, 0.1.3"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package OfficeIMO.MarkdownRenderer.Wpf@0.1.3
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=OfficeIMO.MarkdownRenderer.Wpf&version=0.1.3
                    
Install as a Cake Addin
#tool nuget:?package=OfficeIMO.MarkdownRenderer.Wpf&version=0.1.3
                    
Install as a Cake Tool

OfficeIMO.MarkdownRenderer.Wpf

OfficeIMO.MarkdownRenderer.Wpf provides a reusable WPF MarkdownView control built on WebView2 and OfficeIMO.MarkdownRenderer.

What It Solves

  • renders Markdown through the existing OfficeIMO HTML shell/update pipeline
  • keeps host apps in control of presets, CSS overrides, and link handling
  • supports clipboard copy messages from the shell for code/table actions
  • stays safe for the main OfficeIMO cross-platform CI by only compiling the WPF surface on Windows targets
  • can optionally host pre-rendered HTML bodies for advanced app-specific layouts

Requirements

  • Windows desktop application using WPF
  • WebView2 runtime available on the target machine
  • OfficeIMO.MarkdownRenderer.Wpf plus its OfficeIMO.MarkdownRenderer dependency

If you deploy to machines that may not already have WebView2 installed, ship or bootstrap the Evergreen WebView2 Runtime as part of your installer strategy.

Quick Start

<Window
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:omd="clr-namespace:OfficeIMO.MarkdownRenderer.Wpf;assembly=OfficeIMO.MarkdownRenderer.Wpf">
    <Grid>
        <omd:MarkdownView x:Name="Preview"
                          Preset="Relaxed"
                          DocumentTitle="README"
                          ShellCss=":root { color-scheme: dark; }" />
    </Grid>
</Window>
Preview.Markdown = """
# Hello

This content is rendered by OfficeIMO.MarkdownRenderer.Wpf.
""";

Preview.ConfigureRendererOptions = options =>
{
    options.EnableCodeCopyButtons = true;
    options.EnableTableCopyButtons = true;
};

Preview.ErrorOccurred += (_, args) =>
{
    Debug.WriteLine($"Markdown preview error during {args.Context}: {args.Exception}");
};

Advanced Hosts

For hosts that need to compose richer layouts, such as timelines or card-based discussion views, set BodyHtml directly instead of Markdown. This keeps WebView shell hosting inside OfficeIMO.MarkdownRenderer.Wpf while still allowing the app to build custom HTML from multiple rendered markdown fragments.

Host Theming

The control is intentionally host-driven:

  • use Preset to choose the baseline renderer profile
  • use ShellCss to append host-specific CSS variables and overrides
  • use ConfigureRendererOptions for advanced renderer customization
  • handle NavigationRequested to intercept external links before the default shell launch behavior
  • handle ErrorOccurred if the host wants telemetry, fallback UI, or structured diagnostics

Example:

Preview.ShellCss = """
:root {
  color-scheme: dark;
  --omd-bg: #12141d;
  --omd-fg: #e5e9f0;
  --omd-link: #6cb6ff;
}

body {
  background: var(--omd-bg);
  color: var(--omd-fg);
}

a {
  color: var(--omd-link);
}
""";

Notes

  • BaseHref expects an absolute URI and is ignored when invalid
  • Markdown is the normal content path; BodyHtml is meant for advanced hosts that render multiple markdown fragments into one composed surface
  • the control implements IDisposable so long-lived hosts can release WebView2 resources explicitly when the view is no longer needed
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net8.0-windows7.0 is compatible.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed.  net10.0-windows7.0 is compatible. 
.NET Framework net472 is compatible.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.3 79 4/3/2026
0.1.2 85 4/1/2026
0.1.1 84 3/23/2026
0.1.0 96 3/19/2026

0.1.0: introduces a reusable WPF/WebView2 MarkdownView host for OfficeIMO.MarkdownRenderer with host-driven preset, theming, clipboard, and external-link hooks.