Skip to content

Commit 3525d77

Browse files
Magnus TorsgårdenMagnus Torsgården
authored andcommitted
Only end edit when readonly
1 parent d2bb324 commit 3525d77

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

src/Columns/TableViewColumn.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,7 @@ private static void OnIsReadOnlyChanged(DependencyObject d, DependencyPropertyCh
514514
if (d is TableViewColumn column)
515515
{
516516
if (column.TableView is TableView tableView &&
517+
tableView.IsReadOnly &&
517518
tableView.IsEditing &&
518519
tableView.CurrentCellSlot is not null &&
519520
tableView.GetCellFromSlot(tableView.CurrentCellSlot.Value) is { } currentCell &&

src/TableView.Properties.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -943,6 +943,8 @@ private static void OnIsReadOnlyChanged(DependencyObject d, DependencyPropertyCh
943943
{
944944
tableView.OnIsReadOnlyChanged(e);
945945

946+
if (!tableView.IsReadOnly) return;
947+
946948
if (tableView.IsEditing &&
947949
tableView.CurrentCellSlot is not null &&
948950
tableView.GetCellFromSlot(tableView.CurrentCellSlot.Value) is { } currentCell &&
@@ -951,9 +953,8 @@ tableView.CurrentCellSlot is not null &&
951953
tableView.SetIsEditing(false);
952954
}
953955

954-
if ((tableView.SelectionMode is ListViewSelectionMode.None
956+
if (tableView.SelectionMode is ListViewSelectionMode.None
955957
|| tableView.SelectionUnit is TableViewSelectionUnit.Row)
956-
&& tableView.IsReadOnly)
957958
{
958959
tableView.CurrentCellSlot = null;
959960
}

0 commit comments

Comments
 (0)