In the project, you have encountered some problems with the DataGrid. This is about the bidirectional binding to the checkbox. After you click "addnew" or "edititem transaction process does not allow deferrefresh,
Or English
The reason is caused by the DataGrid editing status. For details, see the http://stackoverflow.com/questions/3354916/what-is-the-proper-way-to-handle-multiple-datagrids-in-a-tab-control-so-that-cel,
Solution: Add a previewmousedown event to the DataGrid as mentioned above, as shown below:
/// <Summary>
/// Click the mouse to handle the handling of a deferrefresh exception
/// </Summary>
/// <Param name = "sender"> </param>
/// <Param name = "E"> </param>
Private void dtgschemeapp_previewmousedown (Object sender, system. Windows. Input. mousebuttoneventargs E)
{
If (isundertabheader (E. originalsource as dependencyobject ))
Committables (this. dtgschemeapp );
}
Private bool isundertabheader (dependencyobject Control)
{
If (control is tabitem)
Return true;
Dependencyobject parent = visualtreehelper. getparent (control );
If (parent = NULL)
Return false;
Return isundertabheader (parent );
}
Private void committables (dependencyobject Control)
{
If (control is DataGrid)
{
DataGrid grid = control as DataGrid;
Grid. commitedit (maid. Row, true );
Return;
}
Int childrencount = visualtreehelper. getchildrencount (control );
For (INT childindex = 0; childindex <childrencount; childindex ++)
Committables (visualtreehelper. getchild (control, childindex ));
}
Here, this. dtgschemeapp is the name of the DataGrid. For more information, see.