This is a migrated thread and some comments may be shown as answers.

Autosize LayoutControls

5 Answers 723 Views
LayoutControl
This is a migrated thread and some comments may be shown as answers.
Andreas Haeusler
Top achievements
Rank 2
Andreas Haeusler asked on 16 Nov 2015, 01:57 PM

Hello,

 

is there a way to enable autosizing on LayoutControls or LayoutGroupControls?

The designer shows Autosize and even AutosizeMode properties, but they dont seem to be working... I'm trying to add a radgridview to a LayoutGroup. The grid is going to show different amounts of rows ​thus having a variable height. I would like the surroundind LayoutGroupControl to wrap around the grid and match its height accordingly.

 

Kind regards,

Andreas

 

 

 

 

 

5 Answers, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 17 Nov 2015, 09:43 AM
Hello Andreas,

Thank you for writing.

The items in the layout control do not have AutoSize functionality. In fact, what you need should be achieved, by controlling the item height, which will size the grid, not the other way around. 

The group item hosts LayoutControlItem and you can set its MinSize/MaxSize properties to control its size. Once the item size is changed, it will change the inner grid size as well:
layoutControlItem1.MaxSize = new Size(0, 60);

Please give this approach a try and let me know how it works for you.

Regards,
Stefan
Telerik

0
Andreas Haeusler
Top achievements
Rank 2
answered on 17 Nov 2015, 10:04 AM

Hello Stefan,

 

changing the layoutControlItem.Size to match the space requirements of the embedded RadGrid seems rather difficult to me. The size of the grid can change at runtime (different parameters for a query, manual resizing of rows/columns), the position and depth in the element tree could be changed by the end user (via the customize dialogs) -- i suppose in a nested layout i would have to propagate the size changes up to other parent containers as well? Sounds terrifying!

 

It really should work like in a tablelayoutpanel with autosize rows/columns -- the innermost controls decide the rows/columns size and therefore the tablelayouts size (constrained by maxsize or available space in parent container).

 

Kind regards,

Andreas

0
Stefan
Telerik team
answered on 17 Nov 2015, 02:52 PM
Hi Andreas,

Indeed, such feature would be useful, so I added it to our feedback portal, where users can vote for it and track its status: http://feedback.telerik.com/Project/154/Feedback/Details/175482-add-radlistcontrol-add-support-for-autosize-of-layoutcontrolitem.

I have updated your Telerik points for this request.

Should you have any other questions or suggestions, do not hesitate to contact us.

Regards,
Stefan
Telerik

0
Mark
Top achievements
Rank 1
answered on 18 Feb 2020, 08:04 PM
Regarding the LayoutControl.  I am evaluating the Telerik Winforms tools.  Is there a way to set the different docked elements as a percentage of the underlying size of the RadLayoutControl.  If the user resizes the form the items would automatically resize and if the item is an absolute size is set the item will not resize.
0
Nadya | Tech Support Engineer
Telerik team
answered on 21 Feb 2020, 12:55 PM

Hello Mark,

RadLayoutControl has an intuitive design that keeps its layout consistent when resizing the form. And this behavior is by design. It does not support such behavior setting elements as a percentage of the underlying size of the RadLayoutControl out of the box. However, the possible solution that I can suggest is to set the MaxSize property of the LayoutControlItem and update it in the Resize event of the form. Thus, you may keep the desired proportion when resizing. Please refer to the following code snippet and the attached gif file:

this.layoutControlItem1.MaxSize = new Size(this.Width / 3, 0);
this.Resize += this.RadForm1_Resize;
private void RadForm1_Resize(object sender, EventArgs e)
{
    this.layoutControlItem1.MaxSize = new Size(this.Width / 3, 0);
}

I hope this helps. Do not hesitate to contact us if you have other questions.

Regards,
Nadya
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
LayoutControl
Asked by
Andreas Haeusler
Top achievements
Rank 2
Answers by
Stefan
Telerik team
Andreas Haeusler
Top achievements
Rank 2
Mark
Top achievements
Rank 1
Nadya | Tech Support Engineer
Telerik team
Share this question
or