alexa
menu

WPF

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

    Show / Hide Table of Contents

    Class SfMarkdownViewer

    Represents a control that renders Markdown content into a rich, formatted document. The control supports Markdown elements such as headings, paragraphs, code blocks, tables, ordered and unordered lists, blockquotes, inline formatting, images, and hyperlinks. The appearance of the rendered content can be customized using 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

    SettingsProperty

    Identifies the Settings dependency property.

    Declaration
    public static readonly DependencyProperty SettingsProperty
    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

    Settings

    Gets or sets the MarkdownStyleSettings that define the visual appearance of markdown elements such as headings, paragraphs, tables, lists, and hyperlinks rendered by the SfMarkdownViewer control.

    Declaration
    public MarkdownStyleSettings Settings { get; set; }
    Property Value
    Type
    MarkdownStyleSettings

    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

    ThemeKeyValues

    Gets or sets the ThemeKeyValues for the MarkdownViewer content element.

    Declaration
    public ThemeKeys ThemeKeyValues { get; set; }
    Property Value
    Type
    ThemeKeys

    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