Getting started

1. Add a reference to ComponentFactory.Krypton.Toolkit.dll and JDHSoftware.Krypton.Toolkit.KryptonOutlookGrid.dll to your project
2. Drag and drop the KryptonOutlookGrid and KryptonOutlookGridGroupBox on the Form.
3. Associate the KryptonOutlookGridGroupBox with the grid by design time or by code using the following :

OutlookGrid1.GroupBox = KryptonOutlookGridGroupBox1;
4. We need that the OutlookGrid listens to the GroupBox. We do this using :

OutlookGrid1.RegisterGroupBoxEvents();

4.bis. Design your grid by configuring your columns as you would do with the standard datagridview. You can do it by code or by design time.
Warning :
  • The column SortMode property must be set to "Programmatic" as the grid will handle itself the sorting.
  • The column Name property must not be empty (whereas the HeaderText could be empty).

5. For grouping and sorting facilities redefine the columns and the grouping type.

 //Setup Columns
OutlookGrid1.AddInternalColumn(ColumnCustomerID, new OutlookgGridDefaultGroup(null), SortOrder.None, false);
OutlookGrid1.AddInternalColumn(ColumnCustomerName, new OutlookGridAlphabeticGroup(null), SortOrder.None, false);
OutlookGrid1.AddInternalColumn(ColumnAddress, new OutlookgGridDefaultGroup(null), SortOrder.None, false);
...
The different parameters for the AddInternalColumn procedure are:
  • Parameter 1 : the column
  • Parameter 2 : the group when the column will be grouped
  • Parameter 3 : the sort order at loading
  • Parameter 4 : grouped or not at loading

6. Filling the grid

//Setup Rows
OutlookGridRow row = new OutlookGridRow();
List<OutlookGridRow> l = new List<OutlookGridRow>();
OutlookGrid1.SuspendLayout();
OutlookGrid1.ClearInternalRows();
foreach (item in items)
{
     try
     {
           row = new OutlookGridRow();
           row.CreateCells(OutlookGrid1, new object[] {
                    item.Prop1,
                    item.Prop2,
                   ....
      });
      l.Add(row);
}
OutlookGrid1.ResumeLayout();
OutlookGrid1.AssignRows(l);
OutlookGrid1.ForceRefreshGroupBox();
OutlookGrid1.Fill();
7. Enjoy !

Last edited Sep 20, 2014 at 5:30 PM by Cocotteseb, version 6