RadRichTextEditor
A comprehensive rich text editor control for .NET MAUI applications that provides WYSIWYG (What You See Is What You Get) editing capabilities for HTML content. The RadRichTextEditor offers an intuitive interface for creating, editing, and formatting rich text documents with extensive formatting options and multimedia support.
The RadRichTextEditor is designed to provide a user-friendly rich text editing experience with professional-grade formatting capabilities. It supports both programmatic manipulation and user interaction through an intuitive interface that adapts to different platforms and input methods.
Core Features:
- HTML Content Support: Native HTML editing with seamless conversion to and from HTML format
- Rich Text Formatting: Comprehensive text styling including fonts, colors, sizes, and decorations
- Document Structure: Support for paragraphs, headings, lists, and text alignment options
- Media Integration: Image insertion and management with size and positioning controls
- Hyperlink Support: Create, edit, and navigate hyperlinks within documents
Text Formatting:
- Font Properties: Font family, size, bold, italic, underline, strikethrough
- Advanced Formatting: Subscript, superscript, text and highlight colors
- Paragraph Formatting: Text alignment (left, center, right, justify), indentation
- Lists: Bulleted and numbered lists with automatic formatting
- Formatting Tools: Clear formatting, undo/redo operations
User Interface:
- Context Menu: Customizable context menu with common editing operations
- Selection Management: Text selection with range-based operations
- Clipboard Operations: Cut, copy, paste with support for rich text and plain text
- Busy Indicator: Visual feedback during long-running operations
Integration and Customization:
- Command Support: Extensive set of built-in commands for all editing operations
- Event Handling: Comprehensive event model for monitoring and customizing behavior
- Styling Options: Customizable appearance with border, background, and corner radius support
- Read-Only Mode: Display-only mode for document viewing scenarios
Ideal for applications requiring document editing, content management systems, email composition, note-taking applications, and any scenario where rich text input and formatting are needed. The control seamlessly integrates with RadRichTextEditorToolbar to provide a complete rich text editing solution with toolbar-based formatting commands.
Dedicated controls: RadRichTextEditorToolbar.
Definition
Namespace:Telerik.Maui.Controls
Assembly:Telerik.Maui.Controls.dll
Syntax:
public class RadRichTextEditor : RadContentView, IRadContentView, IContentView, IView, IElement, ITransform, IPadding, ICrossPlatformLayout
Inheritance: objectRadContentViewRadRichTextEditor
Implements:
Inherited Members
Constructors
Initializes a new instance of the RadRichTextEditor class.
public RadRichTextEditor()
Fields
AutoGenerateContextMenuProperty
BindableProperty
Identifies the AutoGenerateContextMenu property.
public static readonly BindableProperty AutoGenerateContextMenuProperty
BackgroundColorProperty
BindableProperty
Identifies the BackgroundColor property.
public static readonly BindableProperty BackgroundColorProperty
BorderColorProperty
BindableProperty
Identifies the BorderColor property.
public static readonly BindableProperty BorderColorProperty
BorderThicknessProperty
BindableProperty
Identifies the BorderThickness property.
public static readonly BindableProperty BorderThicknessProperty
BusyIndicatorContentProperty
BindableProperty
Identifies the BusyIndicatorContent property.
public static readonly BindableProperty BusyIndicatorContentProperty
BusyIndicatorTemplateProperty
BindableProperty
Identifies the BusyIndicatorTemplate property.
public static readonly BindableProperty BusyIndicatorTemplateProperty
CornerRadiusProperty
BindableProperty
Identifies the CornerRadius property.
public static readonly BindableProperty CornerRadiusProperty
DefaultHyperlinkTextColorProperty
BindableProperty
Identifies the DefaultHyperlinkTextColor property.
public static readonly BindableProperty DefaultHyperlinkTextColorProperty
DefaultHyperlinkVisitedTextColorProperty
BindableProperty
Identifies the DefaultHyperlinkVisitedTextColor property.
public static readonly BindableProperty DefaultHyperlinkVisitedTextColorProperty
DefaultTextColorProperty
BindableProperty
Identifies the DefaultTextColor property.
public static readonly BindableProperty DefaultTextColorProperty
FontAttributesProperty
BindableProperty
Identifies the FontAttributes property.
public static readonly BindableProperty FontAttributesProperty
FontFamilyProperty
BindableProperty
Identifies the FontFamily property.
public static readonly BindableProperty FontFamilyProperty
FontSizeProperty
BindableProperty
Identifies the FontSize property.
public static readonly BindableProperty FontSizeProperty
HighlightTextColorProperty
BindableProperty
Identifies the HighlightTextColor property.
public static readonly BindableProperty HighlightTextColorProperty
HorizontalTextAlignmentProperty
BindableProperty
Identifies the HorizontalTextAlignment property.
public static readonly BindableProperty HorizontalTextAlignmentProperty
IsBusyProperty
BindableProperty
Identifies the IsBusy property.
public static readonly BindableProperty IsBusyProperty
IsDocumentLoadedProperty
BindableProperty
Identifies the IsDocumentLoaded property.
public static readonly BindableProperty IsDocumentLoadedProperty
IsHyperlinkSelectedProperty
BindableProperty
Identifies the IsHyperlinkSelected property.
public static readonly BindableProperty IsHyperlinkSelectedProperty
IsImageSelectedProperty
BindableProperty
Identifies the IsImageSelected property.
public static readonly BindableProperty IsImageSelectedProperty
IsReadOnlyProperty
BindableProperty
Identifies the IsReadOnly property.
public static readonly BindableProperty IsReadOnlyProperty
ListTypeProperty
BindableProperty
Identifies the ListType property.
public static readonly BindableProperty ListTypeProperty
SelectionRangeProperty
BindableProperty
Identifies the SelectionRange property.
public static readonly BindableProperty SelectionRangeProperty
SourceProperty
BindableProperty
Identifies the Source property.
public static readonly BindableProperty SourceProperty
TextColorProperty
BindableProperty
Identifies the TextColor property.
public static readonly BindableProperty TextColorProperty
TextDecorationsProperty
BindableProperty
Identifies the TextDecorations property.
public static readonly BindableProperty TextDecorationsProperty
TextFormattingProperty
BindableProperty
Identifies the TextFormatting property.
public static readonly BindableProperty TextFormattingProperty
Properties
Gets a command to apply center text alignment in the RadRichTextEditor.
public ICommand AlignCenterCommand { get; }
Gets a command to apply justify text alignment in the RadRichTextEditor.
public ICommand AlignJustifyCommand { get; }
Gets a command to apply left text alignment in the RadRichTextEditor.
public ICommand AlignLeftCommand { get; }
Gets a command to apply right text alignment in the RadRichTextEditor.
public ICommand AlignRightCommand { get; }
Gets a command to apply a hyperlink in the RadRichTextEditor. The command takes a single paramerer of type RichTextHyperlink.
public ICommand ApplyHyperlinkCommand { get; }
Gets or sets a value indicating whether to auto-generate the RichTextEditorContextMenuItemBase items for the context menu for this RadRichTextEditor.
public bool AutoGenerateContextMenu { get; set; }
BackgroundColor
Color
Gets or sets the background color of the RadRichTextEditor.
public Color BackgroundColor { get; set; }
BorderColor
Color
Gets or sets the border color of the RadRichTextEditor.
public Color BorderColor { get; set; }
BorderThickness
Thickness
Gets or sets the border thickness of the RadRichTextEditor.
public Thickness BorderThickness { get; set; }
Gets the content to show when the RadRichTextEditor is performing a long-running operation.
public View BusyIndicatorContent { get; }
BusyIndicatorTemplate
DataTemplate
Gets or sets a DataTemplate to be used when displaying a busy indicator during long-running operations, e.g. when loading HTML content. When no template is specified, a default busy indicator is shown.
public DataTemplate BusyIndicatorTemplate { get; set; }
Gets a command to clear the formatting of the text in the RadRichTextEditor.
public ICommand ClearFormattingCommand { get; }
Gets the collection of RichTextEditorContextMenuItemBases used to generate the items of the RadRichTextEditor context menu.
public IList<RichTextEditorContextMenuItemBase> ContextMenuItems { get; }
Gets a command to copy the selected HTML in the RadRichTextEditor to the clipboard.
public ICommand CopyCommand { get; }
CornerRadius
Thickness
Gets or sets the corner radius of the RadRichTextEditor.
public Thickness CornerRadius { get; set; }
Gets a command to cut the selected HTML in the RadRichTextEditor to the clipboard.
public ICommand CutCommand { get; }
Gets or sets the default text color of hyperlinks in the document of the RadRichTextEditor.
public Color DefaultHyperlinkTextColor { get; set; }
This property applies a document-wide default style and does not modify the content. Hyperlink text with an explicit color keeps that color.
Gets or sets the default text color of visited hyperlinks in the document of the RadRichTextEditor.
public Color DefaultHyperlinkVisitedTextColor { get; set; }
This property applies a document-wide default style and does not modify the content. Visited hyperlink text with an explicit color keeps that color.
DefaultTextColor
Color
Gets or sets the default Color of all text in the document of the RadRichTextEditor.
public Color DefaultTextColor { get; set; }
Unlike TextColor, which applies to the current position or selection and changes the document content, this property applies a document-wide default and does not modify the content. Text that has an explicit color applied to it keeps that color. Use this property to align the document with the theme of the application, for example when switching between light and dark mode.
Gets or sets the RichTextFontAttributes of the text in the RadRichTextEditor at the current position or selection.
public RichTextFontAttributes FontAttributes { get; set; }
Gets or sets the font family of the text in the RadRichTextEditor at the current position or selection.
public string FontFamily { get; set; }
Gets or sets the font size of the text in the RadRichTextEditor at the current position or selection.
public RichTextUnit FontSize { get; set; }
HighlightTextColor
Color
Gets or sets the highlight Color of the text in the RadRichTextEditor at the current position or selection.
public Color HighlightTextColor { get; set; }
Gets or sets the RichTextHorizontalAlignment of the text in the RadRichTextEditor at the current position or selection.
public RichTextHorizontalAlignment HorizontalTextAlignment { get; set; }
Gets a command to indent the text in the RadRichTextEditor.
public ICommand IndentCommand { get; }
Gets a command to insert an image in the RadRichTextEditor. The command takes a single paramerer of type RichTextImage.
public ICommand InsertImageCommand { get; }
Gets a value indicating whether the RadRichTextEditor is performing a long-running operation.
public bool IsBusy { get; }
Gets a value indicating whether a document is currently loaded in the RadRichTextEditor.
public bool IsDocumentLoaded { get; }
Gets a value indicating whether a hyperlink is currently selected in the RadRichTextEditor.
public bool IsHyperlinkSelected { get; }
Gets a value indicating whether an image is currently selected in the RadRichTextEditor.
public bool IsImageSelected { get; }
Gets or sets a value indicating whether the RadRichTextEditor is in a read-only mode.
public bool IsReadOnly { get; set; }
Gets or sets the RichTextListType of the text in the RadRichTextEditor at the current position or selection.
public RichTextListType ListType { get; set; }
Gets a command to open a hyperlink in the RadRichTextEditor.
public ICommand OpenHyperlinkCommand { get; }
Gets a command to outdent the text in the RadRichTextEditor.
public ICommand OutdentCommand { get; }
Gets a command to paste from the clipboard to the RadRichTextEditor. The command takes a single paramerer of type RichTextPasteType.
public ICommand PasteCommand { get; }
Gets a command to redo the last changes in the RadRichTextEditor.
public ICommand RedoCommand { get; }
Gets a command to remove a hyperlink in the RadRichTextEditor.
public ICommand RemoveHyperlinkCommand { get; }
Gets a command to remove an image in the RadRichTextEditor.
public ICommand RemoveImageCommand { get; }
Gets a command to select all in the RadRichTextEditor.
public ICommand SelectAllCommand { get; }
Gets or sets the selection range of the text in the RadRichTextEditor.
public RichTextSelectionRange SelectionRange { get; set; }
Gets or sets a RichTextSource providing a rich text to the RadRichTextEditor.
public RichTextSource Source { get; set; }
TextColor
Color
Gets or sets the Color of the text in the RadRichTextEditor at the current position or selection.
public Color TextColor { get; set; }
Gets or sets the RichTextDecorations of the text in the RadRichTextEditor at the current position or selection.
public RichTextDecorations TextDecorations { get; set; }
Gets or sets the RichTextFormatting of the text in the RadRichTextEditor at the current position or selection.
public RichTextFormatting TextFormatting { get; set; }
Gets a command to toggle the bold text style in the RadRichTextEditor.
public ICommand ToggleBoldCommand { get; }
Gets a command to toggle the bullets paragraph style in the RadRichTextEditor.
public ICommand ToggleBulletingCommand { get; }
Gets a command to toggle the italic text style in the RadRichTextEditor.
public ICommand ToggleItalicCommand { get; }
Gets a command to toggle the numbering paragraph style in the RadRichTextEditor.
public ICommand ToggleNumberingCommand { get; }
Gets a command to toggle the strike-through text style in the RadRichTextEditor.
public ICommand ToggleStrikethroughCommand { get; }
Gets a command to toggle the subscript text style in the RadRichTextEditor.
public ICommand ToggleSubscriptCommand { get; }
Gets a command to toggle the superscript text style in the RadRichTextEditor.
public ICommand ToggleSuperscriptCommand { get; }
Gets a command to toggle the underline text style in the RadRichTextEditor.
public ICommand ToggleUnderlineCommand { get; }
Gets a command to undo the last changes in the RadRichTextEditor.
public ICommand UndoCommand { get; }
Methods
Gets asynchronously the currently edited content of the RadRichTextEditor as HTML.
Gets asynchronously the hyperlink under the caret in the RadRichTextEditor.
public Task<RichTextHyperlink> GetHyperlinkAsync()
An instance of the RichTextHyperlink class or null, if there is no hyperlink.
Gets asynchronously the currently selected image in the RadRichTextEditor.
public Task<RichTextImage> GetImageAsync()
An instance of the RichTextImage class or null, if there is no image.
Gets asynchronously the current text selection in the RadRichTextEditor.
public Task<RichTextSelection> GetSelectionAsync()
An instance of the RichTextSelection class or null, if there is no text selection.
protected override void OnPropertyChanged(string propertyName = null)
Events
Raised when the FontAttributes property of the RadRichTextEditor has changed.
public event EventHandler<ValueChangedEventArgs<RichTextFontAttributes>> FontAttributesChanged
Raised when the FontFamily property of the RadRichTextEditor has changed.
public event EventHandler<ValueChangedEventArgs<string>> FontFamilyChanged
Raised when the FontSize property of the RadRichTextEditor has changed.
public event EventHandler<ValueChangedEventArgs<RichTextUnit>> FontSizeChanged
Raised when the HighlightTextColor property of the RadRichTextEditor has changed.
public event EventHandler<ValueChangedEventArgs<Color>> HighlightTextColorChanged
Raised when the HorizontalTextAlignment property of the RadRichTextEditor has changed.
public event EventHandler<ValueChangedEventArgs<RichTextHorizontalAlignment>> HorizontalTextAlignmentChanged
Raised when an error occurs when inserting an image in the RadRichTextEditor.
public event EventHandler<InsertImageErrorEventArgs> InsertImageError
Raised when the IsHyperlinkSelected property of the RadRichTextEditor has changed.
public event EventHandler<ValueChangedEventArgs<bool>> IsHyperlinkSelectedChanged
Raised when the IsImageSelected property of the RadRichTextEditor has changed.
public event EventHandler<ValueChangedEventArgs<bool>> IsImageSelectedChanged
Raised when the IsReadOnly property of the RadRichTextEditor has changed.
public event EventHandler<ValueChangedEventArgs<bool>> IsReadOnlyChanged
Raised when the ListType property of the RadRichTextEditor has changed.
public event EventHandler<ValueChangedEventArgs<RichTextListType>> ListTypeChanged
Raised when an error occurs when openning a hyperlink in the RadRichTextEditor.
public event EventHandler<OpenHyperlinkErrorEventArgs> OpenHyperlinkError
Raised when the user has requested to pick an image in the RadRichTextEditor.
public event EventHandler<PickImageEventArgs> PickImage
Raised when the SelectionRange property of the RadRichTextEditor has changed.
public event EventHandler<ValueChangedEventArgs<RichTextSelectionRange>> SelectionRangeChanged
Raised when the TextColor property of the RadRichTextEditor has changed.
public event EventHandler<ValueChangedEventArgs<Color>> TextColorChanged
Raised when the TextDecorations property of the RadRichTextEditor has changed.
public event EventHandler<ValueChangedEventArgs<RichTextDecorations>> TextDecorationsChanged
Raised when the TextFormatting property of the RadRichTextEditor has changed.
public event EventHandler<ValueChangedEventArgs<RichTextFormatting>> TextFormattingChanged