private void Form1_Load(object sender, EventArgs e) { _flex = new C1FlexGrid(); _flex.Bounds = new System.Drawing.Rectangle(20, 80, 750, 550); this.Controls.Add(_flex); OleDbConnection con = new OleDbConnection("provider=microsoft.jet.oledb.4.0;Data Source=" + Environment.GetFolderPath(Environment.SpecialFolder.Personal) + "\\ComponentOne Samples\\Common\\C1NWind.mdb"); DataTable ordersTable = new DataTable(); new OleDbDataAdapter("Select * from Orders", con).Fill(ordersTable); _flex.DataSource = ordersTable; for (int column = _flex.Cols.Fixed; column < _flex.Cols.Count; column++) { grpByCombo.Items.Add(_flex.Cols[column].Name); } grpByCombo.SelectedIndexChanged += GrpByCombo_SelectedIndexChanged; grpByCombo.SelectedItem = "ShipCountry"; //Hide the grouped column (Optional) _flex.HideGroupedColumns = true; } private void GrpByCombo_SelectedIndexChanged(object sender, EventArgs e) { //setting the grid's GroupDescription property _flex.GroupDescriptions = new GroupDescription[] { new GroupDescription(grpByCombo.SelectedItem.ToString(),System.ComponentModel.ListSortDirection.Ascending, true) }; }
System.Object
C1.Win.C1FlexGrid.GroupDescription