开发者

WPF Datagrid Edit won't allow me to change other cells

I've a Datagrid whose DataContext is assigned to a Dataview. When I try to edit the datagrid shown in the form there appears a red border around the cell being editted AFTER I click out or press Enter. I then try double clicking on another cell but it won't allow me to be in edit mode.

I've tri开发者_运维百科ed following http://www.scottlogic.co.uk/blog/colin/2009/01/wpf-datagrid-committing-changes-cell-by-cell/ and http://codefluff.blogspot.com/2010/05/commiting-bound-cell-changes.html but neither appear to work on my case.

My Code for the CellEditEnding event

 private void dgCompList_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
    {
        if (!isManualEditCommit)
        {
            isManualEditCommit = true;                
            System.Windows.Controls.DataGrid grid = (System.Windows.Controls.DataGrid)sender;
            grid.CommitEdit(DataGridEditingUnit.Row, true);
            isManualEditCommit = false;
        }
    }

I've also tried using CommitEdit() on the actual datagrid itself, but nada. Could someone explain to me what's going on and how to resolve this please?


normally, a red border around the cell is a error state, so it sounds like you have some type of validation error, to me.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜