Ticket T174553
Visible to All Users
Duplicate

How to auto size layout items with RichEditControl in LayoutControl

created 10 years ago

I have a collection of RichTextEdit's that I want to appear on a form,  I want each RichTextEdit to be in it's own expandable window.  The text boxes could contain 1 line of text, several lines of text or no text at all.  Therefore I want to autosize the textboxes based on the size of their content, I am doing this successfully using your autosize functionality.  The problem I am then having is that the textboxes then appear outside of the bounds of the expandable layoutControlGroup that they are contained within.  I am not sure a layoutControlGroup is the best control for this purpose, if it isn't could you suggest a control that would be better suited.  Finally when the controls are larger than the size of the form, I would like a scroll bar to appear, at the moment it is not possible for the controls to get larger than the size of the form.

I have attached a sample to illustrate this

Answers approved by DevExpress Support

created 10 years ago (modified 10 years ago)

Hello,
Thank you for your interest. I can see that you've achieved the rich edit control auto size by setting the ActiveViewType property to Simple and AutoSizeMode to DevExpress.XtraRichEdit.AutoSizeMode.Vertical.
Now, this results in the fact that the layout group isn't resized along with RichEditControl placed in it. We already have an inquiry to support this scenario:
Provide a capability to change the RichEditControl size automatically based on its content when the control is located in LayoutControl
I recommend that you track that ticket to be aware of changes in this regard.

UPDATED by Svetlana:

It is possible to accomplish your task by using LayoutControl. The trick here is to implement the IXtraResizableControl interface for RichEditControl. Once RichEditControl supports this interface, it will provide its own size constraints and notify LayoutControl when its size should be re-calculated. Read the How to: Provide Size Constraints for Control via IXtraResizable Interface help article for more information in this regard.

I updated your sample to show this approach. Take a look at the attached project. I hope that this solution is what you need.

    Show previous comments (3)
    DevExpress Support Team 10 years ago

      Hi,

      Thank you for informing us that the issue has been resolved. Please do not hesitate to contact us in case of any difficulty. We will be happy to help you!

        Would it be possible for you to implement T174553  in Vb, I can't seem to make it work?

        DevExpress Support Team 6 years ago

          Hi,

          You can use any C#-to-VB converter to convert projects to VB.

          For now, I have converted this project to VB for you. Please check it in the attachment.

          Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

          Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.