How to create GridViewMarkupEditorColumn
Environment
Product Version | Product | Author |
---|---|---|
2021.1.223 | RadGridView for WinForms | Nadya Karaivanova |
Description
A common requirement is to have a column in RadGridView that allows text formatting such as bold, italics, underline, link, etc. The following example demonstrates how you can achieve such custom column that uses RadMarkupEditor. Once, you enter the cell in edit mode the dialog is shown and you are able to format the text according to your needs.
As of R1 2023 the Microsoft.mshtml assembly is excluded from Telerik.WinControls.RadMarkupEditor.dll. For .NET Core (.NET 6, .NET 7 or newer) projects, it is necessary to add the reference explicitly to use RadMarkupupEditor since it uses the MS WebBrowser internally.
Solution
RadMarkupEditor is a dialog used to create a formatted text and is suitable to be used as an editor within GridViewColumn.
You should have reference to Telerik.WinControls.RadMarkupEditor assembly in your project.
Let's first create our custom GridViewMarkupEditor that inherits from the BaseGridEditor:
Second, we should create our custom GridViewMarkupColumn that will use the custom GridViewMarkupEditor:
Then, we can use the custom column in the RadGridView: