protected override void LayoutContentControls(LayoutGroupTemplateContainer templateContainer,
                                                      IList <Control> controlsToLayout)
        {
            Control               contentContainer = templateContainer;
            LayoutCSSInfo         layoutCssInfo    = templateContainer.LayoutManager.LayoutCSSInfo;
            LayoutItemCSSInfoBase itemCssInfo      = layoutCssInfo?.GetCssInfo(templateContainer.Model);

            if (itemCssInfo != null && itemCssInfo.CardItem)
            {
                if (((IModelLayoutGroupWeb)templateContainer.Model).IsCollapsibleCardGroup)
                {
                    contentContainer = CreateCollapsibleCardGroup(templateContainer, itemCssInfo);
                }
                else
                {
                    contentContainer = CreateCardGroup(templateContainer, itemCssInfo);
                }
            }
            else
            {
                WebControl header = CreateLayoutContentHeader(templateContainer, false);
                if (header != null)
                {
                    templateContainer.Controls.Add(header);
                }
            }

            foreach (Control control in controlsToLayout)
            {
                if (templateContainer.LayoutManager.DelayedItemsInitialization &&
                    control is LayoutItemTemplateContainerBase @base)
                {
                    @base.Instantiate();
                }

                contentContainer.Controls.Add(control);
            }
        }
        private Control CreateCollapsibleCardGroup(LayoutGroupTemplateContainer templateContainer, LayoutItemCSSInfoBase layoutCssInfo)
        {
            ASPxRoundPanel cardPanel = new ASPxRoundPanel();

            cardPanel.ID             = WebIdHelper.GetCorrectedLayoutItemId(templateContainer.Model, "", "_CardTable");
            cardPanel.BorderWidth    = Unit.Empty;
            cardPanel.HeaderTemplate = new CustomTemplate(templateContainer);

            new CollapsibleCardGroupSynchronizer(templateContainer, cardPanel);
            if (layoutCssInfo.ParentDirection == FlowDirection.Horizontal)
            {
                cardPanel.CssClass = layoutCssInfo.EditorContainerCssClassName;
            }
            else
            {
                cardPanel.CssClass = layoutCssInfo.CardCssClassNameCore;
            }
            SetCustomCSSClass(templateContainer.Model, cardPanel);
            WebControl cardGroupContent = new WebControl(HtmlTextWriterTag.Div);

            cardGroupContent.CssClass = CardGroupContentCssClassName;
            if ((!templateContainer.IsOnTabPage || templateContainer.ParentGroupDirection == FlowDirection.Vertical))
            {
                cardGroupContent.CssClass += " CollapsibleContent";
                cardPanel.AllowCollapsingByHeaderClick = false;
                cardPanel.ShowCollapseButton           = true;
                cardPanel.HeaderStyle.CssClass         = "GroupHeader Label";


                if (templateContainer.HasHeaderImage)
                {
                    cardPanel.HeaderImage.AlternateText = templateContainer.Caption;
                    ASPxImageHelper.SetImageProperties(cardPanel.HeaderImage, templateContainer.HeaderImageInfo);
                }
                if (templateContainer.ShowCaption)
                {
                    if (WebApplicationStyleManager.EnableGroupUpperCase)
                    {
                        cardPanel.HeaderText = templateContainer.Caption.ToUpper();
                    }
                    else
                    {
                        cardPanel.HeaderText = templateContainer.Caption;
                    }
                }
                else
                {
                    cardPanel.HeaderText = "";
                }
                ((ISupportToolTip)this).SetToolTip(cardPanel, templateContainer.Model);
            }
            else
            {
                cardPanel.ShowHeader = false;
            }
            cardPanel.Controls.Add(cardGroupContent);
            templateContainer.Controls.Add(cardPanel);
            return(cardGroupContent);
        }
        private Control CreateCardGroup(LayoutGroupTemplateContainer templateContainer, LayoutItemCSSInfoBase itemCssInfo)
        {
            Table cardTable = RenderHelper.CreateTable();

            cardTable.BorderWidth = Unit.Empty;
            if (itemCssInfo.ParentDirection == FlowDirection.Horizontal)
            {
                cardTable.CssClass = itemCssInfo.EditorContainerCssClassName;
            }
            else
            {
                cardTable.CssClass = itemCssInfo.CardCssClassNameCore;
            }
            SetCustomCSSClass(templateContainer.Model, cardTable);
            cardTable.ID = WebIdHelper.GetCorrectedLayoutItemId(templateContainer.Model, "", "_CardTable");
            TableRow headerRow = new TableRow();

            headerRow.VerticalAlign = VerticalAlign.Top;
            cardTable.Rows.Add(headerRow);
            TableRow contentRow = new TableRow();

            contentRow.VerticalAlign = VerticalAlign.Top;
            cardTable.Rows.Add(contentRow);
            WebControl header = CreateLayoutContentHeader(templateContainer, itemCssInfo.CardItem);

            if (header != null)
            {
                TableCell headerCell = new TableCell();
                headerRow.Cells.Add(headerCell);
                headerCell.Controls.Add(header);
            }
            TableCell contentCell = new TableCell();

            contentCell.CssClass = CardGroupContentCssClassName;
            contentRow.Cells.Add(contentCell);
            templateContainer.Controls.Add(cardTable);
            return(contentCell);
        }