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

Question about LayoutControl

3 Answers 58 Views
LayoutControl
This is a migrated thread and some comments may be shown as answers.
Nicholas
Top achievements
Rank 1
Nicholas asked on 20 Nov 2018, 07:00 PM
So in my deisgner, I have a LayoutControl that has a few items in it and I set the visibility of some of those items to Collpased. I expected the other items that are still visible to kind of properly resize themselves and fill up that space. However, that doesn't seem like the case. The empty space item that holds those items I set to Collapsed still shows on the form. Is there a way with LayoutControl to easily resize some items when other items are in Collapsed visibility state? 

3 Answers, 1 is accepted

Sort by
0
Hristo
Telerik team
answered on 21 Nov 2018, 12:08 PM
Hi Nicholas,

The RadLayoutControl has special arrangement logic and setting the Visibility property of a particular item will force an update in the layout. In order to hide an item, you can use the HideItem method and pass the LayoutControlItem or the control with which it is associated.

I am sending you attached my test project as well as a short video showing the result on my end.

I hope this helps. Let me know if you have other questions.

Regards,
Hristo
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.
0
Nicholas
Top achievements
Rank 1
answered on 21 Nov 2018, 03:04 PM

Thank you that works great. However, when I try to make the same items visible (and put them back into the spot before I hid them) again using the AddItem function like:

this.LayoutControl1.AddItem(this.LayoutControl1.HiddenItems[0] as LayoutControlItem, this.LayoutControlGroupItem1.ContainerElement);

-- or --

this.LayoutControl1.AddItem(this.LayoutControl1.HiddenItems[0] as LayoutControItem, this.ControlSplitterItem1, LayoutControlDropPosition.Bottom);

it really kind of jacks up the form and struggles with putting them in the correct spot as before. I'm assuming this is the proper way to do it. Do you have any suggestions of how else I could do it? Is there an easier way?

 

Thank you in advance.

0
Hristo
Telerik team
answered on 22 Nov 2018, 08:56 AM
Hi Nicholas,

Thank you for writing back.

The AddItem method has several overloads and you can specify the drop position with respect to an existing control, e.g: 
this.radLayoutControl1.AddItem(this.layoutControlItem4, this.radTextBox2, LayoutControlDropPosition.Right);

However, if you need to restore the item to the exact position of its original location, with respect to any resizing which may have been performed by the end user, you can also consider saving and loading the layout: https://docs.telerik.com/devtools/winforms/layoutcontrol/load-layout.

Regards,
Hristo
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
Nicholas
Top achievements
Rank 1
Answers by
Hristo
Telerik team
Nicholas
Top achievements
Rank 1
Share this question
or