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
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
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
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.
Stefan
Telerik
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