private void _buttonAutocomplete_Click(object sender, RoutedEventArgs e) { bool changed = false; try { _tab.Table.Commands.Begin(); foreach (var tuple2 in _tab.List.SelectedItems.OfType <TValue>()) { if (tuple2 != null) { var table = _tab.Table; var tuple = table.GetTuple(tuple2.GetKey <TKey>()); int index = 1; for (int i = index; i < 4; i++) { string id = tuple.GetValue <string>(i); string un = tuple.GetValue <string>(i + 3); if (id != un) { table.Commands.Set(tuple, i + 3, id); changed = true; } } } } } catch (Exception err) { ErrorHandler.HandleException(err); } finally { _tab.Table.Commands.EndEdit(); if (changed) { _tab.Update(); } } }