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. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

MVVM control Height

Thread ID:

Created:

Updated:

Platform:

Replies:

131119 Jun 21,2017 04:33 PM UTC Jun 22,2017 10:40 AM UTC WPF 1
loading
Tags: SfRichTextBoxAdv
Peter Gammon
Asked On June 21, 2017 04:33 PM UTC

Hi,

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?

Thanks

Pete


Venkatesan Mani [Syncfusion]
Replied On June 22, 2017 10:40 AM UTC

Hi Peter Gammon,

Thank you for using Syncfusion products.

Our SfRichTextBoxAdv 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:
Sample.zip

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:
https://help.syncfusion.com/cr/cref_files/wpf/sfrichtextboxadv/Syncfusion.SfRichTextBoxAdv.WPF~Syncfusion.Windows.Controls.RichTextBoxAdv.SfRichTextBoxAdv~TextWrapping.html

Regards,
Venkatesan M.
 

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;