Esempio n. 1
0
        /// <summary>
        /// GridGrouping control getting started customization.
        /// </summary>
        private void GridSettings()
        {
            #region Setting DataSource for GGC

            DataTable parentTable     = GetTable();
            DataTable childTable      = GetChildTable();
            DataTable grandChildTable = GetGrandChildTable();

            GridRelationDescriptor parentToChildRelationDescriptor = new GridRelationDescriptor();
            parentToChildRelationDescriptor.ChildTableName = "MyChildTable";
            parentToChildRelationDescriptor.RelationKind   = RelationKind.RelatedMasterDetails;
            parentToChildRelationDescriptor.RelationKeys.Add("parentID", "ParentID");

            gridGroupingControl1.TableDescriptor.Relations.Add(parentToChildRelationDescriptor);

            GridRelationDescriptor childToGrandChildRelationDescriptor = new GridRelationDescriptor();
            childToGrandChildRelationDescriptor.ChildTableName = "MyGrandChildTable";
            childToGrandChildRelationDescriptor.RelationKind   = RelationKind.RelatedMasterDetails;
            childToGrandChildRelationDescriptor.RelationKeys.Add("child ID", "Child ID");

            parentToChildRelationDescriptor.ChildTableDescriptor.Relations.Add(childToGrandChildRelationDescriptor);

            this.gridGroupingControl1.Engine.SourceListSet.Add("MyParentTable", parentTable);
            this.gridGroupingControl1.Engine.SourceListSet.Add("MyChildTable", childTable);
            this.gridGroupingControl1.Engine.SourceListSet.Add("MyGrandChildTable", grandChildTable);
            this.gridGroupingControl1.DataSource = GetTable();
            this.gridGroupingControl1.ShowCurrentCellBorderBehavior = GridShowCurrentCellBorder.HideAlways;

            #endregion

            #region Setting GridProperties

            this.gridGroupingControl1.TopLevelGroupOptions.ShowAddNewRecordAfterDetails     = false;
            this.gridGroupingControl1.TopLevelGroupOptions.ShowAddNewRecordBeforeDetails    = false;
            this.gridGroupingControl1.ChildGroupOptions.ShowAddNewRecordAfterDetails        = false;
            this.gridGroupingControl1.ChildGroupOptions.ShowAddNewRecordBeforeDetails       = false;
            this.gridGroupingControl1.NestedTableGroupOptions.ShowAddNewRecordAfterDetails  = false;
            this.gridGroupingControl1.NestedTableGroupOptions.ShowAddNewRecordBeforeDetails = false;
            this.gridGroupingControl1.Table.DefaultCaptionRowHeight      = this.gridGroupingControl1.TableOptions.RecordRowHeight = 25;
            this.gridGroupingControl1.Table.DefaultColumnHeaderRowHeight = this.gridGroupingControl1.TableOptions.ColumnHeaderRowHeight = 25;

            this.SetStyle(ControlStyles.UserPaint, true);
            this.gridGroupingControl1.ThemesEnabled        = true;
            this.gridGroupingControl1.GridVisualStyles     = GridVisualStyles.Metro;
            this.gridGroupingControl1.GridOfficeScrollBars = OfficeScrollBars.Metro;

            // Header Text name cahnge
            this.gridGroupingControl1.TableDescriptor.Columns["parentID"].HeaderText  = "Parent ID";
            this.gridGroupingControl1.TableDescriptor.Columns["ParentRel"].HeaderText = "Parent Relation";
            this.gridGroupingControl1.GetTableDescriptor("MyChildTable").Columns["child ID"].HeaderText = "Child ID";

            //Navigate to other control using tabkey navigation
            this.gridGroupingControl1.WantTabKey = false;

            #region Zooming


            // Initialize the Zooming to GridGroupingControl
            zoom = new ZoomGroupingGrid(this.gridGroupingControl1);
            ZoomGroupingGrid.zoomCell = true;
            //used to set multiextended selection mode in gridgrouping control.
            this.gridGroupingControl1.TableOptions.ListBoxSelectionMode = SelectionMode.None;
            //used to set GridCaptionRowHeight.
            zoom.ZoomBorderColor = this.colorPickerButton1.SelectedColor = SystemColors.ActiveBorder;
            zoom.ZoomSize        = new Size(150, 150);
            zoom.ZoomBorderSize  = 15;
            zoom.ZoomFactor      = 1.5f;
            zoom.ZoomImageMode   = ZoomGroupingGrid.ImageMode.Ellipse;
            this.gridGroupingControl1.TableControlQueryAllowSortColumn += new GridQueryAllowSortColumnEventHandler(gridGroupingControl1_TableControlQueryAllowSortColumn);
            #endregion
        }
Esempio n. 2
0
        private void testgrid2_Load(object sender, EventArgs e)
        {
            gc1.ShowGroupDropArea = true;
            // gc1.DataSource = ds_activejobs;
            activeJobsTableAdapter.Fill(this.ds_activejobs.ActiveJobs);

            gc1.TableModel.ReadOnly = true;

            zoom = new ZoomGroupingGrid(gc1);

            // gc1.DataMember = ds_activejobs.ActiveJobs;

            Syncfusion.Grouping.SortColumnDescriptor cd = new Syncfusion.Grouping.SortColumnDescriptor("ShipDate");

            cd.Categorizer = new CustomCategorizer();
            this.gc1.TableDescriptor.GroupedColumns.Add(cd);
            //   this.gc1.QueryCellText += gc1_QueryCellText;

            //Summary Columns

            TestEntities db       = new TestEntities();
            DateTime     maxbatch = db.Batches.Max(p => p.BatchTime);


            lblTimeStamp.Text = "Data Accurate as of: " + maxbatch.ToString();

            #region summary columns

            gc1.TableDescriptor.VisibleColumns.Remove("ShipMonth");
            gc1.TableDescriptor.VisibleColumns.Remove("Batch");
            gc1.TableDescriptor.Columns["ShipDate"].Appearance.AnyRecordFieldCell.Format = "MM/dd/yyyy";

            gc1.TableDescriptor.Appearance.AnyRecordFieldCell.WrapText = true;

            gc1.TableModel.RowHeights.ResizeToFit(GridRangeInfo.Table());

            GridSummaryColumnDescriptor sc1 = new GridSummaryColumnDescriptor();
            sc1.Appearance.AnySummaryCell.Interior = new Syncfusion.Drawing.BrushInfo(Color.FromArgb(192, 255, 165));
            sc1.DataMember  = "RemainingRev";
            sc1.Format      = "{Sum}";
            sc1.Name        = "Remaining Revenue";
            sc1.SummaryType = SummaryType.Int32Aggregate;



            GridSummaryColumnDescriptor sc2 = new GridSummaryColumnDescriptor();
            sc2.Appearance.AnySummaryCell.Interior = new Syncfusion.Drawing.BrushInfo(Color.FromArgb(192, 255, 165));
            sc2.DataMember  = "POValue";
            sc2.Format      = "{Sum}";
            sc2.Name        = "Purchase Order Value";
            sc2.SummaryType = SummaryType.Int32Aggregate;


            //   sc2.TableDescriptor.Columns[0].Appearance.AnyRecordFieldCell.Format = "C";


            GridSummaryColumnDescriptor sc3 = new GridSummaryColumnDescriptor();
            sc3.Appearance.AnySummaryCell.Interior = new Syncfusion.Drawing.BrushInfo(Color.FromArgb(192, 255, 165));
            sc3.DataMember  = "Actual";
            sc3.Format      = "{Sum}";
            sc3.Name        = "Actual";
            sc3.SummaryType = SummaryType.Int32Aggregate;

            sc1.Appearance.AnySummaryCell.Format = "c";
            sc2.Appearance.AnySummaryCell.Format = "c";
            sc3.Appearance.AnySummaryCell.Format = "c";

            GridSummaryColumnDescriptor sc4 = new GridSummaryColumnDescriptor();
            sc4.Appearance.AnySummaryCell.Interior = new Syncfusion.Drawing.BrushInfo(Color.FromArgb(192, 255, 165));
            sc4.DataMember  = "Weld";
            sc4.Format      = "{Sum}";
            sc4.Name        = "Weld Hours Remaining";
            sc4.SummaryType = SummaryType.Int32Aggregate;

            GridSummaryColumnDescriptor sc5 = new GridSummaryColumnDescriptor();
            sc5.Appearance.AnySummaryCell.Interior = new Syncfusion.Drawing.BrushInfo(Color.FromArgb(192, 255, 165));
            sc5.DataMember  = "Machine";
            sc5.Format      = "{Sum}";
            sc5.Name        = "Machine Hours Remaining";
            sc5.SummaryType = SummaryType.Int32Aggregate;

            GridSummaryColumnDescriptor sc6 = new GridSummaryColumnDescriptor();
            sc6.Appearance.AnySummaryCell.Interior = new Syncfusion.Drawing.BrushInfo(Color.FromArgb(192, 255, 165));
            sc6.DataMember  = "Design";
            sc6.Format      = "{Sum}";
            sc6.Name        = "Design Hours Remaining";
            sc6.SummaryType = SummaryType.Int32Aggregate;

            GridSummaryColumnDescriptor sc7 = new GridSummaryColumnDescriptor();
            sc7.Appearance.AnySummaryCell.Interior = new Syncfusion.Drawing.BrushInfo(Color.FromArgb(192, 255, 165));
            sc7.DataMember  = "Tracker";
            sc7.Format      = "{Sum}";
            sc7.Name        = "Tracker Hours Remaining";
            sc7.SummaryType = SummaryType.Int32Aggregate;

            GridSummaryColumnDescriptor sc8 = new GridSummaryColumnDescriptor();
            sc8.Appearance.AnySummaryCell.Interior = new Syncfusion.Drawing.BrushInfo(Color.FromArgb(192, 255, 165));
            sc8.DataMember  = "Build";
            sc8.Format      = "{Sum}";
            sc8.Name        = "Build Hours Remaining";
            sc8.SummaryType = SummaryType.Int32Aggregate;


            GridSummaryRowDescriptor sr1 = new GridSummaryRowDescriptor();
            sr1.SummaryColumns.Add(sc1);
            sr1.SummaryColumns.Add(sc2);
            sr1.SummaryColumns.Add(sc3);
            sr1.SummaryColumns.Add(sc4);
            sr1.SummaryColumns.Add(sc5);
            sr1.SummaryColumns.Add(sc6);
            sr1.SummaryColumns.Add(sc7);
            sr1.SummaryColumns.Add(sc8);

            gc1.Appearance.AnySummaryCell.HorizontalAlignment = GridHorizontalAlignment.Right;

            sr1.Appearance.AnySummaryCell.Interior = new Syncfusion.Drawing.BrushInfo(Color.FromArgb(255, 231, 162));

            gc1.TableDescriptor.SummaryRows.Add(sr1);

            #endregion


            //   gc1.TableControl.PrepareViewStyleInfo += new;

            gc1.TableControl.CommentTipShowing += new CommentTipShowingEventHandler(TableControl_CommentTipShowing);



            //GridConditionalFormatDescriptor f1 = new GridConditionalFormatDescriptor();
            f1.Appearance.AnyRecordFieldCell.Interior  = new Syncfusion.Drawing.BrushInfo(Color.FromArgb(220, 20, 60));
            f1.Appearance.AnyRecordFieldCell.TextColor = Color.White;
            f1.Expression = "[age1] > 10 and [Comp] < 20";
            f1.Name       = "Format1";

            //GridConditionalFormatDescriptor f2 = new GridConditionalFormatDescriptor();
            f2.Appearance.AnyRecordFieldCell.Interior  = new Syncfusion.Drawing.BrushInfo(Color.FromArgb(30, 144, 255));
            f2.Appearance.AnyRecordFieldCell.TextColor = Color.White;
            f2.Expression = "[age1] < 10";
            f2.Name       = "Format2";

            gc1.TableDescriptor.ConditionalFormats.Add(f1);
            gc1.TableDescriptor.ConditionalFormats.Add(f2);

            gc1.QueryCellStyleInfo             += new GridTableCellStyleInfoEventHandler(gc1_QueryCellStyleInfo);
            gc1.SourceListListChangedCompleted += Gc1_SourceListListChangedCompleted;

            GridColumnDescriptor desc1 = new GridColumnDescriptor();

            desc1.MappingName = "BaseID";
            desc1.Appearance.AnyRecordFieldCell.Interior = new Syncfusion.Drawing.BrushInfo(Color.FromArgb(237, 240, 246));

            gc1.TableControl.HScroll = true;
            gc1.TableControl.VScroll = true;

            if (gc1.TableControl.HScrollBar.InnerScrollBar != null && gc1.TableControl.VScrollBar != null)
            {
                gc1.TableControl.HScrollBar.InnerScrollBar.Height = 50;
                gc1.TableControl.VScrollBar.InnerScrollBar.Height = 50;
            }


            gc1.TableControl.ControlAdded += TableControl_ControlAdded;
        }