private static void UpdateAccordionControlHeight(AccordionControlElement elem) { Control control = elem.ContentContainer.Controls.Count > 0 ? elem.ContentContainer.Controls[0] : null; LayoutControl lc = control as LayoutControl; int height = elem.ContentContainer.Padding.Vertical; if (lc == null && control != null) { if (control.Controls.Count > 0) { lc = control.Controls[0] as LayoutControl; height = control.Padding.Vertical; } } if (lc != null) { lc.LayoutChanged(); elem.ContentContainer.Height = lc.Root.MinSize.Height + height; } }