Home Forums WinForms controls Xceed Grid for WinForms Calculated Column

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #15030 |

    Hi

    I’m trying to create a calculated column. My problem is however that I change the underlying dataset and then need to recalc my column values. It seems as if I can use the DataRowsChanged event but I will have to recalculate all my rows. The problem with this is that it’s way to processor intensive due to the amount of data and my calculation (It’s not just a X+y*10). I need to only recalc the rows that get changed/added in the underlying dataset. Even better if I could know what cells have changed in those rows.

    The ValueChanging (Cell) event as we know does not get fired by a change in the underlying data set.

    Please help

    Regards
    Greg

    Imported from legacy forums. Posted by g.kroger (had 1871 views)

    User (Old forums)
    Member
    Post count: 23064

    You can use the SiblingValueChanged event on the cell to accomplish this. This event is triggered for every cell of the row in which one cell value is changed. It is also triggered when binding/refreshing the grid, so you may want to set a flag when first loading the data so that the event handler does not do anything, unless you also need to do your calculation when first loading the data into the grid.

    e.g.:

    //at form_load

    private void Form1_Load(object sender, System.EventArgs e)
    {
    foreach( DataCell cell in dataRowTemplate1.Cells )
    {
    cell.SiblingValueChanged += new EventHandler(cell_SiblingValueChanged);
    }

    binding = true;
    oleDbDataAdapter1.Fill( dataSet11 );
    binding = false;
    }

    //Event handler

    private static bool binding;

    private void cell_SiblingValueChanged(object sender, EventArgs e)
    {
    if( !binding )
    System.Diagnostics.Debug.WriteLine( ( ( Cell )sender).Value.ToString() );
    }

    Imported from legacy forums. Posted by André (had 2940 views)

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.