Пример #1
0
        public void InstantiateIn(Control container)
        {
            GridViewDetailRowTemplateContainer templateContainer = (GridViewDetailRowTemplateContainer)container;
            ASPxPageControl pageControl  = RenderHelper.CreateASPxPageControl();
            object          masterObject = null;

            if (masterListViewCore.ObjectSpace != null)
            {
                masterObject = masterListViewCore.ObjectSpace.GetObject(templateContainer.Grid.GetRow(templateContainer.VisibleIndex));
            }
            pageControl.EnableCallBacks = true;
            pageControl.Width           = Unit.Percentage(100);
            pageControl.ContentStyle.Paddings.Padding = Unit.Pixel(0);
            container.Controls.Add(pageControl);
            foreach (IMemberInfo mi in masterListViewCore.ObjectTypeInfo.Members)
            {
                if (mi.IsList && mi.IsPublic)
                {
                    //IObjectSpace os = WebApplication.Instance.CreateObjectSpace();
                    IObjectSpace os         = App.CreateObjectSpace();
                    string       listViewId = DevExpress.ExpressApp.Model.NodeGenerators.ModelNestedListViewNodesGeneratorHelper.GetNestedListViewId(mi);
                    Type         type       = mi.ListElementType;

                    if (!isInit)
                    {
                        cs = new PropertyCollectionSource(os, type, os.GetObject(masterObject), mi, CollectionSourceMode.Proxy);
                        cs.CollectionChanged += cs_CollectionChanged;
                        os.Committing        += os_Committing;
                        isInit = true;
                    }

                    ListView tempListView = WebApplication.Instance.CreateListView(listViewId, cs, false);

                    Frame detailsFrame = WebApplication.Instance.CreateFrame(TemplateContext.NestedFrame);
                    detailsFrame.SetView(tempListView);//tempListView detailsListView
                    //detailsListView.LayoutManager
                    detailsFrame.CreateTemplate();
                    Control detailsTemplateControl = (Control)detailsFrame.Template;
                    detailsTemplateControl.ID = string.Format("detailsTemplateControl_{0}", mi.Name);
                    TabPage page = new TabPage(mi.Name);
                    page.Controls.Add(detailsTemplateControl);
                    pageControl.TabPages.Add(page);
                    //((Control)detailsFrame.Template).FindControl("ToolBar").Visible = false;
                }
            }
        }