maui-404639-html-edit-toolbar.md
The HTML Edit control includes the built-in adaptive DXToolbar that you can use to change content at runtime. You can also create a custom DXToolbar with a set of items that meet your requirements. This topic describes how to display a custom toolbar and bind it to HTML Edit commands.
Review our demo app on GitHub to get more information on how to replicate the built-in DXToolbar:
View Example: DevExpress .NET MAUI HTML Edit - Replicate a Built-In Toolbar
Follow the steps below to create a custom HTML Edit toolbar:
Set the HtmlEdit.ShowToolbar property to false to hide the built-in DXToolbar.
Wrap the HTML Edit and a custom DXToolbar within a container (Grid, StackLayout, or another) and place it inside a SafeKeyboardAreaView:
Bind a toolbar item to a required HtmlEdit command:
The HTML Edit control includes the HtmlEditCommands class that stores commands. You can bind these commands to a custom toolbar item or perform operations with HTML Edit from code-behind.
| Command | Description |
|---|---|
| Undo | Gets the command that cancels changes resulting from the last operation. |
| Redo | Gets the command that reapplies the last action that was undone in the HtmlEdit control. |
| Command | Description |
|---|---|
| SetBackgroundColor | Gets the command that sets the background color of the selected/typed text text. |
| SetForegroundColor | Gets the command that sets the foreground color of the selected/typed text text. |
| Command | Description |
|---|---|
| SetHeadingLevel | Gets the command that sets the selected/under caret text’s heading level to the specified value. |
| Command | Description |
|---|---|
| ToggleBold | Gets the command that toggles the selected/typed text text’s bold emphasis. |
| ToggleItalic | Gets the command that toggles the selected/typed text text’s italic emphasis. |
| ToggleStrikethrough | Gets the command that toggles the selected/typed text text’s strikethrough emphasis. |
| ToggleUnderline | Gets the command that toggles the selected/typed text text’s underline emphasis. |
| Command | Description |
|---|---|
| ToggleCenterAlignment | Gets the command that toggles the selected/under caret text’s alignment to center. |
| ToggleLeftAlignment | Gets the command that toggles the selected/under caret text’s alignment to left. |
| ToggleRightAlignment | Gets the command that toggles the selected/under caret text’s alignment to right. |
| ToggleJustifyAlignment | Gets the command that toggles the selected/under caret text’s alignment to fit it along the left and right margins. |
| SetLineHeight | Gets the command that sets the selected/under caret text line height value. |
| Command | Description |
|---|---|
| DecreaseIndent | Gets the command that toggles the selected/under caret text’s between ordered list and regular text. |
| IncreaseIndent | Gets the command that toggles the selected/under caret text’s between bullet list and regular text. |
| ToggleBulletList | Gets the command that increases indent of the selected/under caret text. |
| ToggleOrderedList | Gets the command that decreases indent of the selected/under caret text. |
Load and Retrieve ContentThis topic describes how to load content to a HTML Edit from different sources (file, stream, and uri) and retrieve the displayed content.Select ContentThis topic describes how to select the displayed content.Modify ContentThis topic describes how to customize the displayed content.