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.
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:
Alternatively you can edit the Plain Text field if you need not HTML-like text formatting.
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:
RadMarkupDialog dialog = new RadMarkupDialog();
DialogResult result = dialog.ShowDialog();
if (result == DialogResult.OK)
{
MessageBox.Show(dialog.Value);
}
Dim dialog As New RadMarkupDialog()
Dim result As DialogResult = dialog.ShowDialog()
If result = DialogResult.OK Then
MessageBox.Show(dialog.Value)
End If
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:
RadMarkupDialog dialog = new RadMarkupDialog();
dialog.Value = "Initial";
dialog.ShowDialog();
Dim dialog As New RadMarkupDialog()
dialog.Value = "Initial"
dialog.ShowDialog()
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:
RadMarkupDialog dialog = new RadMarkupDialog();
dialog.DefaultFont = SystemFonts.DefaultFont;
dialog.ShowDialog();
Dim dialog As New RadMarkupDialog()
dialog.DefaultFont = SystemFonts.DefaultFont
dialog.ShowDialog()
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.
Markup View
Markup view contains only the clipboard commands.