Provides information on the Row and the IDataField in the Grid that have been updated.

Namespace: Dapfor.Net.Ui
Assembly: Dapfor.Net (in Dapfor.Net.dll) Version: 2.10.3.24917 (2.10.3.24917)

Syntax

C#
public sealed class GridRowUpdateEventArgs : EventArgs
Visual Basic
Public NotInheritable Class GridRowUpdateEventArgs
	Inherits EventArgs
Visual C++
public ref class GridRowUpdateEventArgs sealed : public EventArgs
F#
[<SealedAttribute>]
type GridRowUpdateEventArgs =  
    class
        inherit EventArgs
    end

Examples

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

    [DoubleFormat(Precision = 3, ShortForm = true, ShowZero = false)]
    public double Price
    {
        get { return price; }
        set
        {
            if (price != value)
            {
                price = value;
                //Notify about color changing
                if (PropertyChanged != null)
                {
                    PropertyChanged(this, new PropertyChangedEventArgs("Price"));
                }
            }
        }
    }

    public DateTime Maturity
    {
        get { return maturity; }
    }

    public event PropertyChangedEventHandler PropertyChanged;
}

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

    Console.WriteLine("Current thread: {0}", Thread.CurrentThread.ManagedThreadId);

    grid.RowUpdated += delegate(object sender, GridRowUpdateEventArgs e)
    {
        int threadId = Thread.CurrentThread.ManagedThreadId;
        Console.WriteLine("The data object has been updated. Row = {0}, Field = {1}, Value = {2}, Thread = {3}", e.Row.VisibleIndex, e.DataField.Id, e.DataField.Value, threadId);
    };

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

    //The object will notify the grid through the INotifyPropertyChanged, and the grid will automatically 
    //invalidate, sort, filter and highlight the affected cells.
    product.Price = 12.34;

    //Notify the grid from the non-GUI thread
    ThreadPool.QueueUserWorkItem(delegate
    {
        int threadId = Thread.CurrentThread.ManagedThreadId;
        Console.WriteLine("Update data object from non-GUI thread (Thread = {0})", threadId);

        //If the call comes from the non-GUI thread, the grid will synchronize them without blocking the calling thread.
        product.Price = 25.66;
    });
}

//Console output:
//Current thread: 7
//The data object has been updated. Row = 0, Field = Price, Value = 12,34, Thread = 7
//Update data object from non-GUI thread (Thread = 9)
//The data object has been updated. Row = 0, Field = Price, Value = 25,66, Thread = 7

Inheritance Hierarchy

System..::..Object
  System..::..EventArgs
    Dapfor.Net.Ui..::..GridRowUpdateEventArgs

Thread Safety

The event RowUpdated is raised only in the GUI thread even the data object had notified the Grid from other thread.

See Also