diff --git a/MAUI/Rich-Text-Editor/AutoSize.md b/MAUI/Rich-Text-Editor/AutoSize.md index 20e979b60..43423c28b 100644 --- a/MAUI/Rich-Text-Editor/AutoSize.md +++ b/MAUI/Rich-Text-Editor/AutoSize.md @@ -9,44 +9,36 @@ documentation: ug # AutoSize in .NET MAUI Rich Text Editor (SfRichTextEditor) -The .NET MAUI Rich Text Editor control supports dynamically changing its height based on the content. This feature can be enabled by setting the `EnableAutoSize` property to `True`. When enabled, the editor will automatically resize to fit its content, eliminating the need for scroll bars within the control. By default, the `EnableAutoSize` property is `False`. +The .NET MAUI Rich Text Editor control can dynamically change its height to fit the content by setting the `EnableAutoSize` property to `True`. By default, this property is `False`. -The following code example shows how to enable `EnableAutoSize` in the Rich Text Editor control. +When `EnableAutoSize` is active, the editor’s height will grow or shrink as content is added or removed. For the best results, place the editor within a layout that can accommodate its changing height, such as a `VerticalStackLayout`. + +The following example demonstrates how to place an auto-sizing `SfRichTextEditor` inside a `VerticalStackLayout`. {% tabs %} {% highlight xaml %} - + + + {% endhighlight %} {% highlight c# %} +VerticalStackLayout verticalStackLayout = new VerticalStackLayout(); SfRichTextEditor richTextEditor = new SfRichTextEditor(); richTextEditor.EnableAutoSize = true; +verticalStackLayout.Children.Add(richTextEditor); +this.Content = verticalStackLayout; {% endhighlight %} {% endtabs %} -When `EnableAutoSize` is active, the editor’s height will grow or shrink as content is added or removed. +The editor will now automatically resize to match the content's height. ![.NET MAUI Rich Text Editor with AutoSize enabled](images/richtexteditor-autosize.gif) -N> When using `EnableAutoSize`, it is recommended not to set the `HeightRequest` property on the `SfRichTextEditor`, as this may interfere with the automatic resizing behavior. For the best results, place the editor within a layout that can accommodate its changing height, such as a `VerticalStackLayout` inside a `ScrollView`. - -The following example demonstrates how to place an auto-sizing `SfRichTextEditor` within a `ScrollView`. - -{% tabs %} -{% highlight xaml %} - - -