CellSelectionMapper removes row from selection map if no columns are selected

This commit is contained in:
John Colvin committed 2018-01-16 19:46:25 -05:00
1 parent ba49bb854e
commit 748cccedca
1 file changed
+7 -2
@@ -17,7 +17,11 @@ namespace mbts.ui.controls
HashSet<TCol> cols;
if (selection_map.TryGetValue(row, out cols)) {
object ck = DataGridEx.GetCellKey(cell_info.Column);
if (ck is TCol) cols.Remove((TCol)ck);
if (ck is TCol) {
cols.Remove((TCol)ck);
if (cols.Count == 0)
selection_map.Remove(row);
}
}
}
}
@@ -27,7 +31,8 @@ namespace mbts.ui.controls
object ck = DataGridEx.GetCellKey(cell_info.Column);
if (ck is TCol) {
HashSet<TCol> cols;
if (!selection_map.TryGetValue(row, out cols)) selection_map.Add(row, cols = new HashSet<TCol>());
if (!selection_map.TryGetValue(row, out cols))
selection_map.Add(row, cols = new HashSet<TCol>());
cols.Add((TCol)ck);
}
}