0
DataGrid
에 몇 가지 문제가 있습니다. DataGrid
을 CanUserAddRows
으로 설정하면 DataGrid
하단에 새 검은 색 행이 있지만이 행은 예기치 않은 동작을합니다. 새 행을 클리핑하고 다른 셀에 포커스를 전달하면 행이 비어 있어도 생성되므로 . 행이 비어 있으면 새 항목을 만들지 말고 동작을 변경하고 싶습니다. 그러나 RowEditEnding
을 e.Cancel=true
으로 설정하면 NewItemPlaceHolder
이 사라지고 그 이후로 아무 행이나 추가 할 수 없습니다. 어떤 신체가이 문제에 대한 해답을 찾았습니까?잘못된 NewItemPlaceholder 동작
protected override void OnRowEditEnding(DataGridRowEditEndingEventArgs e)
{
if ((e.Row.Item as DataRowView).Row.ItemArray[0] == null || (e.Row.Item as DataRowView).Row.ItemArray[0].ToString() == String.Empty)
{
e.Cancel = true;
IEditableCollectionView collection = Items as IEditableCollectionView;
if (collection.IsAddingNew)
{
collection.CancelNew();
}
}
base.OnRowEditEnding(e);
}
케어를 새로 고쳐을 할 수있는 방법을 발견? –
"DeferRefresh가 AddItem 또는 NewItem 트랜잭션에 허용되지 않습니다."예외가 발생하면 New를 취소합니다. – Nandhi
이 솔루션을 사용하는 것이 좋습니다! http://stackoverflow.com/a/42763784/973344 –