# RadMarkupDialog

RadMarkupEditor is a dialog used at Design time and Run time for creation of the formatted text supported by our WinForms suite. As any other standard dialog in WinForms, this dialog inherits from *CommonDialog* class.

> caption Figure 1: RadMarkupDialog

![Telerik UI for WinForms RadMarkupDialog for creating formatted text](https://www.telerik.com/products/winforms/documentation/assets/1ef7651827d17f86d519db5582d5d872/tpf-radmarkupdialog002.png)

### Design Time

You can start the editor at Design Time by opening the drop down of some **Text** property and then clicking on *Start MarkupEditor* button:

![Telerik UI for WinForms Text property menu with the Start MarkupEditor command](https://www.telerik.com/products/winforms/documentation/assets/b2a1deefac32e25c9da5347b4d8f17f5/tpf-radmarkupdialog001.png)

Alternatively you can edit the *Plain Text* field if you need not HTML-like text formatting. 

> caution Please note that you can still use the *Plain Text* field to edit HTML tags manually.

When started at Design Time, the font *size* and *name* are taken from the edited control or visual element e.g. RibbonTab. No tags are added for this font in the generated markup although the font name or size can be explicitly set as well.

### Run Time

To start the editor at Run Time, create a new instance of the dialog and use *ShowDialog* method:

 

 

```C#
RadMarkupDialog dialog = new RadMarkupDialog();
DialogResult result = dialog.ShowDialog();
if (result == DialogResult.OK)
{
    MessageBox.Show(dialog.Value);
}

```

```VB.NET
Dim dialog As New RadMarkupDialog()
Dim result As DialogResult = dialog.ShowDialog()
If result = DialogResult.OK Then
    MessageBox.Show(dialog.Value)
End If

```

 

> caution In order to use RadMarkupDialog at RunTime, add reference to **Telerik.WinControls.RadMarkupEditor**.

*ShowDialog* returns the *DialogResult* enumeration. The returned value is *DialogResult.OK* if one of the Apply buttons is pressed and *DialogResult.Cancel* if the Close button is pressed. The *Value* property contains the edited HTML as a string.

The *Value* property can be set to the RadMarkupDialog before it is shown which will be the initial value of the dialog:

 

 

```C#
RadMarkupDialog dialog = new RadMarkupDialog();
dialog.Value = "Initial";
dialog.ShowDialog();

```

```VB.NET
Dim dialog As New RadMarkupDialog()
dialog.Value = "Initial"
dialog.ShowDialog()

```

 

> important As of **R2 2020 SP1** RadMarkupDialog offers the **RawValue** property. It returns the value as HTML of the underlying WebBrowser control.

You can also set the default font size and name before showing the dialog using the **DefaultSize** property:

 

 

```C#
RadMarkupDialog dialog = new RadMarkupDialog();
dialog.DefaultFont = SystemFonts.DefaultFont;
dialog.ShowDialog();

```

```VB.NET
Dim dialog As New RadMarkupDialog()
dialog.DefaultFont = SystemFonts.DefaultFont
dialog.ShowDialog()

```

 

> note RadMarkupDialog depends on Microsoft.mshtml assembly. Please refer to the Deployment section for further details.

## RadMarkupDialog user interface

The user interface of RadMarkupDialog should be fairly intuitive. The two tabs - Design and Markup - are used for navigation between design and markup views.

## Design View 

The first RibbonBar group (Clipboard) contains the Paste, Cut, and Copy commands.

The second RibbonBar group (Font) contains the Font-Family, Font-Size, Bold, Italic, Underline, Highlight, and Font-Color commands.

The third RibbonBar group (Lists) contains the Unordered List, and Ordered List commands.

The fourth RibbonBar group (Link) contains the link command.

The fifth RibbonBar group (Apply) contains the \*Apply \*command. You should click this button to persist your editing at Design Time or to receive DialogResult.OK at Run Time. Otherwise (pressing the close button of RadMarkupDialog), the change will not be persisted at Design Time or DialogResult.Cancel will be returned at Run Time. 

![Telerik UI for WinForms RadMarkupDialog Design View with formatting, list, link, and Apply commands](https://www.telerik.com/products/winforms/documentation/assets/1ef7651827d17f86d519db5582d5d872/tpf-radmarkupdialog002.png)

## Markup View

Markup view contains only the clipboard commands.

![Telerik UI for WinForms RadMarkupDialog Markup View with clipboard commands](https://www.telerik.com/products/winforms/documentation/assets/5fd16d89fd0617684669221de8fc5187/tpf-radmarkupdialog003.png)

## See Also

* [Animations](https://www.telerik.com/products/winforms/documentation/telerik-presentation-framework/animations)

* [Dependency Properties](https://www.telerik.com/products/winforms/documentation/telerik-presentation-framework/dependency-properties)

* [Handling User Input](https://www.telerik.com/products/winforms/documentation/telerik-presentation-framework/handling-user-input)

* [HTML-like Text Formatting](https://www.telerik.com/products/winforms/documentation/telerik-presentation-framework/html-like-text-formatting)

* [Inherit themes from RadControls derivatives](https://www.telerik.com/products/winforms/documentation/telerik-presentation-framework/inherit-themes-from-radcontrols-derivatives)

* [How to Display and Edit HTML Text in GridView Cells](https://www.telerik.com/products/winforms/documentation/knowledge-base/display-and-edit-html-text-in-grid-cells)
