Home Forums WinForms controls Xceed Grid for WinForms SummaryCell or ValueCell – Need text and calc in cell Reply To: SummaryCell or ValueCell – Need text and calc in cell

User (Old forums)
Member
Post count: 23064

You can simply keep a reference to the Group in the ValueChanged event, and use it in the Idle event handler.

e.g.:

private Group group;

void Form1_ValueChanged( object sender, EventArgs e )

{

    //Get the group of the DataRow that was just updated

    DataCell cell = sender as DataCell;

    if( cell != null )

    {

        group = cell.ParentRow.ParentGroup

as Group;

    }

    Application.Idle += new EventHandler( Application_Idle );

}

 

//Do the update to the ValueRow

void Application_Idle( object sender, EventArgs e )

{

    Application.Idle -= new EventHandler( Application_Idle );

    if( group != null )

    {

        SummaryRow sumRow = group.FooterRows[ 0 ] as SummaryRow;

        ValueRow valueRow = group.FooterRows[ 1 ] as ValueRow;

        if( sumRow != null && valueRow != null )

        {

            valueRow.Cells[

“SupplierID” ].Value = sumRow.Cells[ “SupplierID” ].Value;

        }

    }

}

 

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