MemoEditor
MemoEditor
allows users to view and edit multi-line text in a dropdown window. The control's edit box does not provide text editing operations.
The control's main features include:
- A user can click the edit box or the built-in dropdown button to open the dropdown text editor.
- You can enable text wrapping in the dropdown editor.
- Controlling scrollbar visibility in the dropdown window.
- The edit box can display a special icon when the dropdown editor contains text. An empty icon is displayed when there is no text.
- The edit box can display a preview of the dropdown text (the first text line) instead of the special icon.
Specify Text and Text Options
Use the MemoEditor.EditorValue
property to get and set text in the dropdown editor. If the specified text contains NewLine characters, the editor displays the text on multiple lines.
Text Wrapping
The MemoEditor.TextWrapping
property allows you to activate automatic text wrapping at the editor's right edge. Set this property to the Avalonia.Media.TextWrapping.Wrap
value to enable regular text wrapping mode.
Accept Tab and Enter keys During Input
Users can press the Tab and Enter keys to insert Tab and Return characters in the text. You can use the following options to change this behavior:
MemoEditor.MemoAcceptsReturn
— Specifies whether the dropdown editor accepts pressing Enter. If the property is disabled, the dropdown editor ignores the Enter key.MemoEditor.MemoAcceptsTab
— Specifies whether the dropdown editor accepts pressing Tab. If the property is disabled, focus is moved to the next control in the tab order when the Tab key is pressed.
Example - How to enable text wrapping in a MemoEditor
xmlns:mxe="https://schemas.eremexcontrols.net/avalonia/editors"
xmlns:mxtl="https://schemas.eremexcontrols.net/avalonia/treelist"
<mxe:MemoEditor x:Name="memoEditor" Grid.Row="1" MemoTextWrapping="Wrap"/>
Indicate the Presence of Text
The control's default behavior is to display a special icon to indicate the presence of text:
Disable the MemoEditor.ShowIcon
property to hide the icon and display the first line of the text in the edit box:
Open the Dropdown Editor
A user can invoke the dropdown editor with a click on the edit box or the built-in dropdown button.
The MemoEditor.IsPopupOpen
property allows you to open and close the dropdown editor in code.
Specify Visibility of Scrollbars
Use the following properties to manage visibility of scrollbars:
MemoEditor.MemoHorizontalScrollBarVisibility
— Gets or sets anAvalonia.Controls.Primitives.ScrollBarVisibility
value that specifies the visibility of the horizontal scrollbar in the dropdown text editor.MemoEditor.MemoVerticalScrollBarVisibility
— Gets or sets anAvalonia.Controls.Primitives.ScrollBarVisibility
value that specifies the visibility of the vertical scrollbar in the dropdown text editor.