The grid is specifically designed for working with data that is added or updated in any thread, including non-GUI threads. Data is added using synchronous method of synchronization that blocks the caller thread at the time of adding. Below we provide an example that demonstrates thread safety of adding data to the grid.

 Copy imageCopy
public void PopulateGrid(Grid grid)
    //Add data object to the grid from the calling thread. 
    grid.Rows.Add(new Product());

    //Create other product
    Product otherProduct = new Product();

    //Add the product to the Grid from other thread - it is safe
        //Add the product

        //Update the property. The object will notify the grid from the non-GUI thread.
        //The grid will synchronize threads without blocking the calling thread. 
        //Then it will refresh, sort and filter appropriate row if needed. All operations are thread safe.
        otherProduct.Price = 12.33;

Back to .Net Grid HowTo topics