winformsgridviewgroup-bydevexpressxtragrid

Winform Grid grouped data and checkbox


I am developing a small app that is supposed to query some structured data on DB​, let the user choose which data to update and update it on DB. The windoows form app is developed with C# on VS2008 and I am using DevExpress 8.2 (can't update).

The data is mapped onto a list of objects of this type:

public class object {
public int ID,
public string KeyPart1
public string KeyPart2
public string Name
public datetime Creation
}

I'd like to show this data in a grid - grouped by both KeyPart1 and KeyPart2 - with a built-in checkbox on the groups so I am able to select the groups

How can i do it?


Solution

  • I would suggest viewing this example in the DevExpress GitHub to see how to create a custom GridView that allows for a checkbox in the group row:

    Multiple selection using checkbox (web style)

    The version available on GitHub targets v8.3.2 but I think it can be adapted to your 8.2 version.

    You can use the GridColumn's Group method with each of your KeyPart columns to group them sequentially.

    Note also that your class properties should offer get and set accessors and not be public fields. The GridControl requires the use of properties if you wish to edit the data in the cells.