Index: Core/Common/src/Core.Common.Controls/DataGrid/DataGridViewControl.cs =================================================================== diff -u -r61849787ccd3c614e8ad17e2bf78a69aeb50d3f6 -r2dc715aea959c14261e9969d4efc942f2dd6464c --- Core/Common/src/Core.Common.Controls/DataGrid/DataGridViewControl.cs (.../DataGridViewControl.cs) (revision 61849787ccd3c614e8ad17e2bf78a69aeb50d3f6) +++ Core/Common/src/Core.Common.Controls/DataGrid/DataGridViewControl.cs (.../DataGridViewControl.cs) (revision 2dc715aea959c14261e9969d4efc942f2dd6464c) @@ -44,7 +44,7 @@ /// Returns true when the is in edit mode. /// False otherwise. /// - public bool IsCurrentCellInEditMode + public bool IsCurrentCellInEditMode { get { @@ -83,7 +83,7 @@ Name = string.Format("column_{0}", dataPropertyName), ReadOnly = readOnly, DefaultCellStyle = - { + { DataSourceNullValue = string.Empty }, AutoSizeMode = autoSizeMode @@ -334,6 +334,7 @@ dataGridView.GotFocus += DataGridViewOnGotFocus; dataGridView.CellEndEdit += DataGridViewOnCellEndEdit; dataGridView.DataError += DataGridViewOnDataError; + dataGridView.Leave += DataGridViewOnLeave; } private void DataGridViewOnColumnAdded(object sender, DataGridViewColumnEventArgs e) @@ -375,6 +376,20 @@ } } + private void DataGridViewOnLeave(object sender, EventArgs eventArgs) + { + if (!Disposing && dataGridView.CurrentCell != null && dataGridView.CurrentCell.IsInEditMode) + { + // Try to end the edit action + if (!dataGridView.EndEdit()) + { + // Cancel the edit action on validation errors + dataGridView.CancelEdit(); + dataGridView.Rows[dataGridView.CurrentCell.RowIndex].ErrorText = string.Empty; + } + } + } + #endregion } } \ No newline at end of file Index: Core/Common/src/Core.Common.Gui/Forms/ViewManager/AvalonDockDockingManager.cs =================================================================== diff -u -ref1c61d94f2aec3b4ff32fcf03253d7ad386c8e5 -r2dc715aea959c14261e9969d4efc942f2dd6464c --- Core/Common/src/Core.Common.Gui/Forms/ViewManager/AvalonDockDockingManager.cs (.../AvalonDockDockingManager.cs) (revision ef1c61d94f2aec3b4ff32fcf03253d7ad386c8e5) +++ Core/Common/src/Core.Common.Gui/Forms/ViewManager/AvalonDockDockingManager.cs (.../AvalonDockDockingManager.cs) (revision 2dc715aea959c14261e9969d4efc942f2dd6464c) @@ -322,13 +322,13 @@ return; } + ControlHelper.UnfocusActiveControl(activeView as IContainerControl); + if (!views.Contains(view)) { return; // not our view } - ControlHelper.UnfocusActiveControl(activeView as IContainerControl); - activeView = view; if (ViewActivated != null)