alexa
menu

WinUI

  • 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.MarkdownViewer.WinUI.dll
    Syntax
    public class SfMarkdownViewer : Control

    Constructors

    SfMarkdownViewer()

    Initializes a new instance of the SfMarkdownViewer class.

    Declaration
    public SfMarkdownViewer()

    Fields

    SettingsProperty

    Identifies the Settings dependency property.

    Declaration
    public static readonly DependencyProperty SettingsProperty
    Field Value
    Type
    Microsoft.UI.Xaml.DependencyProperty

    SourceProperty

    Identifies the Source dependency property.

    Declaration
    public static readonly DependencyProperty SourceProperty
    Field Value
    Type
    Microsoft.UI.Xaml.DependencyProperty

    Properties

    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

    Methods

    GetHtmlText()

    Gets the current markdown content converted to HTML.

    Declaration
    public string GetHtmlText()
    Returns
    Type
    System.String

    OnApplyTemplate()

    Builds the visual tree for the SfMarkdownViewer class.

    Declaration
    protected 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