Contains a collection of Cells and information about data object, its location, hierarchy in the data grid, etc.

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


public sealed class Row
Visual Basic
Public NotInheritable Class Row
Visual C++
public ref class Row sealed
type Row =  class end


Data can be added into the grid via GridControl.Rows.Add(object dataObject) method call. This method returns object of Row type. To build a hierarchy, it is enough to call the Row.Add(object) method, which in turn returns a new Row object. This way a programmer can build almost any hierarchy in the GridControl. All headers and rows have their own zero-based hierarchical level that is defined by Header.Level and Row.Level properties. To display data in every row, GridControl takes header of the same level as that row. However, if that level doesn't have a header, the header for the previous hierarchical level is used. In other words, if only one header is present, the grid will behave like Microsoft Windows Explorer.

GridControl supports many data types because of the IDataAccessor interface that is one of the most crucial part of the grid. The main purpose of this interface is to normalize presentation of different data types in the grid. There are lots of implementations of IDataAccessor interface. This way, a programmer can add his own implementation to broaden the list of data types that can be used by the GridControl. When you call GridControl.Rows.Add('your object'), an implementation of the IDataAccessor interface is created implicitly for 'your object' and the GridControl works with it only via the IDataAccessor proxy, making no difference between the data types.

For different objects the process of getting or setting values of a data object may vary. For user-defined classes you can use the reflection mechanism to get or set values. For IList<(Of <(<'T>)>)> the grid gets them with a certain index; for IDictionary<string, object> with a string key so on. IDataAccessor may support or not support data field identifiers it merely depends on its nature. If an object of user defined class is inserted into the grid, than its property name become the identifiers in the IDataAccessor by default. However, sometimes identifiers may be absent, e.g. if you you use an IList<(Of <(<'T>)>)> object as a parameter of the method GridControl.Rows.Add(object dataObject). In such case, to display data in cells the GridControl uses indices of IList<(Of <(<'T>)>)> and index of the column which is calculated when it is inserted into the header.

 Copy imageCopy
//Some data object
public class Product : INotifyPropertyChanged
    //Some fields
    private double price;
    private DateTime maturity;

    [DoubleConverter(Precision = 3, ShortForm = true, ShowZero = false)]
    public double Price
        get { return price; }
            price = value;
            if (PropertyChanged != null)
                PropertyChanged(this, new PropertyChangedEventArgs("Price"));

    public DateTime Maturity
        get { return maturity; }

    public event PropertyChangedEventHandler PropertyChanged;

//Using sample
public void PopulateGridWithDataObjects(GridControl grid)
    //Initialize the grid
    grid.Headers.Add(new Header());
    grid.Headers[0].Add(new Column("Price"));
    grid.Headers[0].Add(new Column("Maturity"));

    grid.Headers.Add(new Header());
    grid.Headers[1].Add(new Column("FirstName"));
    grid.Headers[1].Add(new Column("SecondName"));

    //Add data object to the grid. The object will be implicitly wrapped by the DataObjectAccessor class
    Product product = new Product();
    Row productRow = grid.Rows.Add(product);

    //Build some hierarchy ()...
    productRow.Add(new Customer("John", "Smith"));

    //Or from another thread - this is safe.
        productRow.Add(new Customer("Sherlock", "Holmes"));

    //This call will notify the grid through the INotifyPropertyChanged
    //The grid will automatically repaint affected cells, and also sort and filter the row.
    product.Price = 12.36;

    //Or from another thread - this is safe.
        product.Price = 14.21;

Inheritance Hierarchy


See Also