We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

MVVM control Height


I am currently using the SfRichTextBoxAdv with the extension class to enable binding using MVVM. The problem I am encountering involves the height of the control. I wish to adjust the height of the control based on the content which is displayed. I have can achieve 80% of what I need by setting the LayoutType property to Block but there are cases in which I need a horizontal scrollbar to enable viewing of large tables for example, the text wraps which isn’t an issue. I have tried to use the Continuous Layout Type but it doesn’t adjust to the height of the content meaning lots of whitespace if my content is small e.g a single line. Please could you advise how I would get the desired effect of height adjusted by content and horizontal scroll if need?



1 Reply

VM Venkatesan Mani Syncfusion Team June 22, 2017 10:40 AM UTC

Hi Peter Gammon,

Thank you for using Syncfusion products.

OurSfRichTextBoxAdv control will be displayed with default size (200 x 200), when placed in controls/panels which will measure it with infinity. For example, ScrollViewer, StackPanel and Grid with Row.Height="Auto" or Column.Width="Auto" will measure with infinity. So, set the desired height to the Height property of SfRichTextBoxAdv. Otherwise use SfRichTextBoxAdv inside controls/panels which will measure proper height for its children. For example, Grid with Row.Height=” *”.

You can resize the height of the SfRichTextBoxAdv control based on rich text content at sample level using an extension class.
1. Implement an extension class for SfRichTextBoxAdv and Use it in the sample.
2: Set height of the control to minimum value example 50px.
3. Implement event handler for ContentChanged event of the control.
4. In ContentChanged Event access the vertical scroll bar and determine the content height based on scroll bar value.
5. Set the content height to the SfRichTextBoxAdv control.
We have also prepared a sample to demonstrate the same. Please find the sample from the following link.
sample link:
Regarding the text wrapping:
Our SfRichTextBoxAdv control have the option to enable/disable the text wrapping in Continuous and Block layout mode. Please refer the below API reference link for more information like remarks, sample codes.
API reference link:
Venkatesan M.

Live Chat Icon For mobile
Up arrow icon