alexa
menu

WPF

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download

    Show / Hide Table of Contents

    Class SfMarkdownViewer

    A WPF control that renders markdown content into a rich, formatted document with extensive styling customization. The control supports markdown elements including headings, paragraphs, code blocks, tables, ordered and unordered lists, blockquotes, inline formatting, images, and hyperlinks. Appearance is controlled via Syncfusion.UI.Xaml.Markdown.MarkdownStyleSettings. The markdown source can be provided as raw text, a file path, or an HTTP/HTTPS URL.

    Inheritance
    System.Object
    SfMarkdownViewer
    Namespace: Syncfusion.UI.Xaml.Markdown
    Assembly: Syncfusion.SfMarkdownViewer.WPF.dll
    Syntax
    public class SfMarkdownViewer : Control

    Constructors

    SfMarkdownViewer()

    Initializes a new instance of the SfMarkdownViewer class.

    Declaration
    public SfMarkdownViewer()

    Fields

    MermaidBlockTemplateProperty

    Identifies the MermaidBlockTemplate dependency property.

    Declaration
    public static readonly DependencyProperty MermaidBlockTemplateProperty
    Field Value
    Type
    System.Windows.DependencyProperty

    SourceProperty

    Identifies the Source dependency property.

    Declaration
    public static readonly DependencyProperty SourceProperty
    Field Value
    Type
    System.Windows.DependencyProperty

    Properties

    MermaidBlockTemplate

    Gets or sets the System.Windows.DataTemplate used to render mermaid diagrams and flowcharts within the MarkdownViewer control. When a mermaid code block is encountered in the markdown and this template is set, the template is used for rendering instead of the default code block rendering.

    Declaration
    public DataTemplate MermaidBlockTemplate { get; set; }
    Property Value
    Type
    System.Windows.DataTemplate

    Source

    Gets or sets the markdown source to render. The source can be a file path, an HTTP/HTTPS URL, or raw markdown text. If a valid file path is provided, the file contents are loaded. If a valid HTTP/HTTPS URL is provided, the content is downloaded from the URL. Otherwise, the source is treated as raw markdown text.

    Declaration
    public string Source { get; set; }
    Property Value
    Type
    System.String

    Methods

    OnApplyTemplate()

    Builds the visual tree for the SfMarkdownViewer class.

    Declaration
    public override void OnApplyTemplate()

    Events

    HyperlinkClicked

    Occurs when a hyperlink is clicked within the rendered markdown content. Handle this event to perform custom actions such as opening URLs or navigating within the application. Set Cancel to true to prevent the default action (opening the URL).

    Declaration
    public event EventHandler<MarkdownHyperlinkClickedEventArgs> HyperlinkClicked
    Event Type
    Type
    System.EventHandler<MarkdownHyperlinkClickedEventArgs>
    Back to top Generated by DocFX
    Copyright © 2001 - 2026 Syncfusion Inc. All Rights Reserved