示例#1
0
        /// <summary>
        /// 重建参数视图
        /// </summary>
        private void RecreateTableView(AccordionControlElementCollection elements
                                       , ReportTableView parentTableView
                                       , IEnumerable <ReportTableController> tables)
        {
            if (parentTableView != null)
            {
                parentTableView.ChildTableViews = new List <Views.ReportTableView>();
            }
            foreach (var reportDataTable in tables)
            {
                ExtendAddonPublic.GetAddonExtendProperties(reportDataTable);

                var elementTableView = new AccordionControlElement();
                elementTableView.Name     = reportDataTable.ID;
                elementTableView.Style    = ElementStyle.Group;
                elementTableView.Expanded = true;
                elementTableView.Text     = String.Format("{0}({1})", reportDataTable.Caption, reportDataTable.TableName);
                elements.Add(elementTableView);


                var reportTableView = reportDataTable.CreateView() as ReportTableView;
                reportTableView.Dock         = DockStyle.Top;
                reportTableView.AutoSize     = true;
                reportTableView.RowCount     = 0;
                reportTableView.BorderStyle  = BorderStyle.FixedSingle;
                reportTableView.DataFetched += ReportTableView_DataFetched;
                reportTableView.DataRequery += ReportTableView_DataRequery;

                var elementParameterView = new AccordionControlElement();
                elementParameterView.Name     = reportDataTable.ID;
                elementParameterView.Style    = ElementStyle.Item;
                elementParameterView.Expanded = true;
                elementParameterView.Text     = "查询";
                var container = new AccordionContentContainer();
                container.Controls.Add(reportTableView);
                container.Height = reportTableView.Height;
                elementParameterView.ContentContainer = container;
                reportTableView.SizeChanged          += (sender, e) => {
                    container.Height = reportTableView.Height;
                };
                TableControls.Add(reportDataTable.TableName, reportTableView);
                elementTableView.Elements.Add(elementParameterView);
                if (parentTableView != null)
                {
                    parentTableView.ChildTableViews.Add(reportTableView);
                }

                if (reportDataTable.ChildTables.IsNotNullOrEmpty())
                {
                    RecreateTableView(elementTableView.Elements, reportTableView, reportDataTable.ChildTables);
                }
            }
        }
        AccordionContentContainer CreateContainerWithTree(List <string> paths)
        {
            var res  = new AccordionContentContainer();
            var tree = CreateTree(paths);

            if (tree == null)
            {
                return(null);
            }

            tree.Dock  = DockStyle.Fill;
            res.Height = 350;
            res.Controls.Add(tree);
            return(res);
        }
        private void UpdateAccordionContainerHeight(AccordionContentContainer control)
        {
            if (control.Controls.Count == 0)
            {
                return;
            }
            LayoutControl layout = control.Controls[0] as LayoutControl;

            if (layout != null)
            {
                control.Height = layout.Root.MinSize.Height;
            }
            if (control.Controls[0].AutoSize)
            {
                control.Height = control.Controls[0].GetPreferredSize(new Size(int.MaxValue, int.MaxValue)).Height;
            }
        }
示例#4
0
        private void InitAccordionControl()
        {
            acControl.BeginUpdate();
            AccordionControlElement acRootGroupHome    = new AccordionControlElement();
            AccordionControlElement acItemActivity     = new AccordionControlElement();
            AccordionControlElement acItemNews         = new AccordionControlElement();
            AccordionControlElement acRootItemSettings = new AccordionControlElement();

            acControl.ElementClick += new ElementClickEventHandler(this.accordionControl1_ElementClick);

            //
            // Root Group 'Home'
            //
            acRootGroupHome.Elements.AddRange(new AccordionControlElement[] {
                acItemActivity,
                acItemNews
            });
            acRootGroupHome.Expanded = true;
            acRootGroupHome.ImageOptions.ImageUri.Uri = "Home;Office2013";
            acRootGroupHome.Name = "acRootGroupHome";
            acRootGroupHome.Text = "Home";
            //
            // Child Item 'Activity'
            //
            acItemActivity.Name  = "acItemActivity";
            acItemActivity.Style = ElementStyle.Item;
            acItemActivity.Tag   = "idActivity";
            acItemActivity.Text  = "Activity";
            //
            // Child Item 'News'
            //
            acItemNews.Name  = "acItemNews";
            acItemNews.Style = ElementStyle.Item;
            acItemNews.Tag   = "idNews";
            acItemNews.Text  = "News";
            //
            // Root Item 'Settings' with ContentContainer
            //
            acRootItemSettings.ImageOptions.ImageUri.Uri = "Customization;Office2013";
            acRootItemSettings.Name  = "acRootItemSettings";
            acRootItemSettings.Style = ElementStyle.Item;
            acRootItemSettings.Text  = "Settings";
            //
            // itemSettingsControlContainer
            //
            AccordionContentContainer itemSettingsControlContainer = new AccordionContentContainer();
            HyperlinkLabelControl     hyperlinkLabelControl1       = new HyperlinkLabelControl();
            ToggleSwitch toggleSwitch1 = new ToggleSwitch();

            acControl.Controls.Add(itemSettingsControlContainer);
            acRootItemSettings.ContentContainer = itemSettingsControlContainer;
            itemSettingsControlContainer.Controls.Add(hyperlinkLabelControl1);
            itemSettingsControlContainer.Controls.Add(toggleSwitch1);
            itemSettingsControlContainer.Appearance.BackColor            = System.Drawing.SystemColors.Control;
            itemSettingsControlContainer.Appearance.Options.UseBackColor = true;
            itemSettingsControlContainer.Height = 60;
            //
            // hyperlinkLabelControl1
            //
            hyperlinkLabelControl1.Location        = new System.Drawing.Point(26, 33);
            hyperlinkLabelControl1.Size            = new System.Drawing.Size(107, 13);
            hyperlinkLabelControl1.Text            = "www.devexpress.com";
            hyperlinkLabelControl1.HyperlinkClick += new DevExpress.Utils.HyperlinkClickEventHandler(this.hyperlinkLabelControl1_HyperlinkClick);
            //
            // toggleSwitch1
            //
            toggleSwitch1.EditValue = true;
            toggleSwitch1.Location  = new System.Drawing.Point(24, 3);
            toggleSwitch1.Properties.AllowFocused = false;
            toggleSwitch1.Properties.AutoWidth    = true;
            toggleSwitch1.Properties.OffText      = "Offline Mode";
            toggleSwitch1.Properties.OnText       = "Onlne Mode";
            toggleSwitch1.Size     = new System.Drawing.Size(134, 24);
            toggleSwitch1.Toggled += new System.EventHandler(this.toggleSwitch1_Toggled);

            acControl.Elements.AddRange(new DevExpress.XtraBars.Navigation.AccordionControlElement[] {
                acRootGroupHome,
                acRootItemSettings
            });

            acRootItemSettings.Expanded = true;

            acControl.EndUpdate();
        }