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
This section covers the essential properties, methods, and events of the .NET MAUI `SfRichTextEditor` for handling content and user interactions.
13
13
14
-
## Handling Content
14
+
## Setting Text
15
15
16
-
### Setting and Getting HTML Content
16
+
The Rich Text Editor control displays the text/formatted text(HTML string) that can be set using the `Text` property.
17
17
18
-
The rich content of the editor, including all formatting, is accessible through the `Text` property. You can use this property to both load and retrieve the content as an HTML string.
18
+
{% tabs %}
19
19
20
-
{% tabs %}
21
-
22
-
{% highlight xaml %}
20
+
{% highlight xaml %}
23
21
24
-
<rte:SfRichTextEditor Text="The Syncfusion .NET MAUI Rich Text Editor is a WYSIWYG editor for creating and editing rich text content." />
22
+
<richtexteditor:SfRichTextEditor Text="The <b> rich text editor </b> component is WYSIWYG editor that provides the best user experience to create and update the content" />
25
23
26
24
{% endhighlight %}
27
25
28
-
{% highlight c# %}
26
+
{% highlight C# %}
29
27
30
28
SfRichTextEditor richTextEditor = new SfRichTextEditor();
31
-
richTextEditor.Text = "The Syncfusion .NET MAUI Rich Text Editor is a WYSIWYG editor for creating and editing rich text content.";
32
-
this.Content = richTextEditor;
29
+
richtexteditor.Text = "The <b>rich text editor</b> component is WYSIWYG editor that provides the best user experience to create and update the content";
33
30
34
31
{% endhighlight %}
35
32
36
33
{% endtabs %}
37
34
38
-
### Getting HTML Content Asynchronously
35
+
##Retrieving HTML text
39
36
40
-
To ensure you get the most up-to-date content, especially after recent edits, you can retrieve the HTML string asynchronously using the `GetHtmlString` method.
37
+
The formatted text of Rich Text Editor can be retrieved using the `HtmlText` property of `SfRichTextEditor`.
41
38
42
-
{% tabs %}
39
+
{% tabs %}
43
40
44
-
{% highlight c# %}
41
+
{% highlight C# %}
45
42
46
-
string htmlContent = await rte.GetHtmlText();
43
+
string HTMLText = richtexteditor.HtmlText;
47
44
48
45
{% endhighlight %}
49
46
50
47
{% endtabs %}
51
48
52
49
53
-
###Getting Selected HTML
50
+
## Getting Selected HTML
54
51
55
52
To retrieve the HTML representation of the currently selected content, use the `GetSelectedText` method.
You can define the default appearance for any new text typed into the editor. These settings apply to text that does not have any other specific formatting applied.
67
+
68
+
*`DefaultFontFamily`: Sets the default font family for the content.
69
+
*`DefaultFontSize`: Sets the default font size.
70
+
*`DefaultTextColor`: Sets the default color of the text.
71
+
72
+
{% tabs %}
73
+
{% highlight xaml %}
74
+
75
+
<rte:SfRichTextEditor DefaultFontFamily="Impact"
76
+
DefaultFontSize="14"
77
+
DefaultTextColor="DarkGreen" />
78
+
79
+
{% endhighlight %}
80
+
{% highlight c# %}
81
+
82
+
SfRichTextEditor richTextEditor = new SfRichTextEditor();

91
+
92
+
67
93
## Placeholder
68
94
69
-
The editor can display a placeholder text when the content is empty. This is useful for prompting the user. The placeholder is cleared as soon as the user starts typing.
95
+
The editor can display a `placeholder` text when the content is empty. This is useful for prompting the user. The placeholder is cleared as soon as the user starts typing.
96
+
97
+
*`PlaceholderFontFamily`: Sets the font family of the placeholder text.
98
+
*`PlaceholderFontSize`: Sets the font size of the placeholder text.
99
+
*`PlaceholderColor`: Sets the color of the placeholder text.
0 commit comments