Gets a value indicating whether this Row is a group (pseudo-item without data object that groups the rows with specified criteria).

Namespace: Dapfor.Wpf.Controls
Assembly: Dapfor.Wpf (in Dapfor.Wpf.dll) Version: 4.1.0.26317 (4.1.0.26317)

Syntax

C#
public bool IsGroup { get; }
Visual Basic
Public ReadOnly Property IsGroup As Boolean
	Get
Visual C++
public:
property bool IsGroup {
	bool get ();
}
F#
member IsGroup : bool with get

Property Value

Type: Boolean
true if this Row is a group; otherwise, false.

Remarks

Wpf GridControl enables multiple data grouping in headers by any column at any hierarchical level. When data is grouped by a specific column, GridControl searches all rows within a group that has similar values. When a group is organized, a Row that doesn't contain a data object is added to the data grid. The Row.IsGroup property of such row will always return true, and Row["column id"].Value will return a value by which data is grouped. All rows with values that meet grouping conditions are attached to the newly created group. Before a new data object is added, GridControl verifies whether there is any group with the required value on the current hierarchical level. If there is no such group, a new group is created. When the Row.Update method is invoked, the grid checks whether a row conforms to group value. If there are no more rows in the group, the group is removed from the grid.

In programming the grouping feature can be enabled via the Column.Grouped property. Sequential invocation of this property for several columns results in data grouping of these columns. The column with grouping remains visible unless Column.Visible property is set to false. Sorting (and multiple sorting) can be enabled or disabled for grouped columns because sorting and grouping are completely independent processes. The list of grouped columns can be viewed with Header.GroupedColumns collection property. A user can also group columns in the data grid. To use this ability the user just needs to drag a column to a special panel on the grid's header. However, this is not possible if height of this panel is set to 0.

When grouping and filtering are enabled simultaneously, the GridControl checks every group for visible rows. If there are no visible rows, the group is filtered. If a single unfiltered row appears, the row of the group also becomes visible.

Real-time grouping in non event-driven model is done with Row.Update method.

 Copy imageCopy
public void NonEventModelGrouping(GridControl grid)
{
    //Initialize the grid
    grid.Headers.Add(new Header());
    grid.Headers[0].Add(new Column("Name"));
    grid.Headers[0].Add(new Column("Color"));
    grid.Headers[0].Add(new Column("Price"));

    //Group data by color
    grid.Headers[0]["Color"].Grouped = true;

    //Populate the grid
    Row blackMercedes = grid.Rows.Add(new object[] { "Mercedes", Colors.Black, 25000d });
    Row whiteMercedes = grid.Rows.Add(new object[] { "Mercedes", Colors.White, 23000d });
    Row whiteBMW = grid.Rows.Add(new object[] { "BMW", Colors.White, 35000d });

    //The grid has two groups - 1=> black mercedes 2=> white mercedes and bmw
    //The first group has only the black mercedes
    Debug.Assert(1 == grid.Nodes[0].Children.Count);
    Debug.Assert("Mercedes" == (string)grid.Nodes[0].Children[0]["Name"].Value);

    //The second group has two cars: white mercedes and white bmw
    Debug.Assert(2 == grid.Nodes[1].Children.Count);
    Debug.Assert("Mercedes" == (string)grid.Nodes[1].Children[0]["Name"].Value);
    Debug.Assert("BMW" == (string)grid.Nodes[1].Children[1]["Name"].Value);
    //Change color of the white mercedes
    whiteMercedes["Color"].Value = Colors.Green;

    //Now we have 3 groups. The last contains only the green mercedes
    Debug.Assert(1 == grid.Nodes[2].Children.Count);
    Debug.Assert("Mercedes" == (string)grid.Nodes[2].Children[0]["Name"].Value);
    Debug.Assert(Colors.Green == (Color)grid.Nodes[2].Children[0]["Brush"].Value);
}

In the event-driven model Row.Update method is called every time when a data object sends a notification. Once again we'd like to emphasize the importance of such model as it removes dependency of the business layer on wpf controls and on Dapfor assemblies as well.

See Also