AutoSize in .NET MAUI Rich Text Editor (SfRichTextEditor)
8 Sep 20251 minute to read
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.
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.
<VerticalStackLayout>
<rte:SfRichTextEditor x:Name="richTextEditor"
EnableAutoSize="True"/>
</VerticalStackLayout>VerticalStackLayout verticalStackLayout = new VerticalStackLayout();
SfRichTextEditor richTextEditor = new SfRichTextEditor();
richTextEditor.EnableAutoSize = true;
verticalStackLayout.Children.Add(richTextEditor);
this.Content = verticalStackLayout;The editor will now automatically resize to match the content’s height.

NOTE
When using
EnableAutoSize, it is recommended not to set theHeightRequestproperty on theSfRichTextEditor, as this may interfere with the automatic resizing behavior.