You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: hub/apps/design/controls/rich-edit-box.md
+26-5Lines changed: 26 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -1,21 +1,22 @@
1
1
---
2
-
description: You can use a RichEditBox control to enter and edit rich text documents that contain formatted text, hyperlinks, and images. You can make a RichEditBox read-only by setting its IsReadOnly property to true.
2
+
description: You can use a RichEditBox control to enter and edit rich text documents that contain formatted text, hyperlinks, images, and math equations. You can make a RichEditBox read-only by setting its IsReadOnly property to true.
3
3
title: RichEditBox
4
4
ms.assetid: 4AFC0DFA-3B89-434D-9F86-4309CCFF7839
5
5
label: Rich edit box
6
6
template: detail.hbs
7
-
ms.date: 02/26/2025
7
+
ms.date: 04/11/2025
8
8
ms.topic: article
9
9
doc-status: Published
10
10
ms.localizationpriority: medium
11
11
---
12
+
12
13
# Rich edit box
13
14
14
-
You can use a RichEditBox control to enter and edit rich text documents that contain formatted text, hyperlinks, and images. You can make a RichEditBox read-only by setting its IsReadOnly property to **true**.
15
+
You can use a **RichEditBox** control to enter and edit rich text documents that contain formatted text, hyperlinks, and images, and math equations. You can make a RichEditBox read-only by setting its IsReadOnly property to **true**.
15
16
16
17
## Is this the right control?
17
18
18
-
Use a **RichEditBox** to display and edit text files. You don't use a RichEditBox to get user input into you app the way you use other standard text input boxes. Rather, you use it to work with text files that are separate from your app. You typically save text entered into a RichEditBox to a .rtf file.
19
+
Use a RichEditBox to display and edit text files. You don't use a RichEditBox to get user input into you app the way you use other standard text input boxes. Rather, you use it to work with text files that are separate from your app. You typically save text entered into a RichEditBox to a .rtf file.
19
20
20
21
- If the primary purpose of the multi-line text box is for creating read-only documents (such as blog entries or the contents of an email message), and those documents require rich text, use a [rich text block](./rich-text-block.md) instead.
21
22
- When capturing text that will only be consumed and not redisplayed to users, use a plain text input control.
@@ -38,7 +39,7 @@ This rich edit box has a rich text document open in it. The formatting and file
38
39
39
40

The RichEditBox can display and edit math equations using [UnicodeMath](https://www.unicode.org/notes/tn28/UTN28-PlainTextMath-v3.1.pdf). The equations are stored and retrieved in [MathML 3.0](https://www.w3.org/Math/) format.
198
+
199
+
By default, the RichEditBox control does not interpret input as math. To enable math mode, call [SetMathMode](/windows/windows-app-sdk/api/winrt/microsoft.ui.text.richedittextdocument.setmathmode) on the [TextDocument](/windows/windows-app-sdk/api/winrt/microsoft.ui.xaml.controls.richeditbox.textdocument) property, passing the value [RichEditMathMode.MathOnly](/windows/windows-app-sdk/api/winrt/microsoft.ui.text.richeditmathmode) (to disable math mode, call [SetMathMode](/windows/windows-app-sdk/api/winrt/microsoft.ui.text.richedittextdocument.setmathmode) but pass in the value [NoMath](/windows/windows-app-sdk/api/winrt/microsoft.ui.text.richeditmathmode)).
This enables UnicodeMath input to be automatically recognized and converted to MathML in real time. For example, entering 4^2 converts to 4<sup>2</sup>, and 1/2 converts to ½. See the [WinUI 3 Gallery app](https://apps.microsoft.com/detail/9p3jfpwwdzrc) for more examples.
206
+
207
+
To save the math content of a rich edit box as a MathML string, call [GetMathML](/windows/windows-app-sdk/api/winrt/microsoft.ui.text.richedittextdocument.getmathml).
To set the math content of a rich edit box, call [SetMathML](/windows/windows-app-sdk/api/winrt/microsoft.ui.text.richedittextdocument.setmathml), passing in a MathML string.
214
+
194
215
## Choose the right keyboard for your text control
195
216
196
217
To help users to enter data using the touch keyboard, or Soft Input Panel (SIP), you can set the input scope of the text control to match the kind of data the user is expected to enter. The default keyboard layout is usually appropriate for working with rich text documents.
0 commit comments