void MoveSelectedRow(int stepDir) { if (SelectedItem == null) { MessageBox.Show("No item selected."); return; } var currentIndex = Rows.IndexOf(SelectedItem); if (stepDir == -1 && currentIndex == 0) { return; } if (stepDir == 1 && currentIndex == Rows.Count() - 1) { return; } var item = SelectedItem.GetFieldInfo(); _tableDefinitionModel.Definition.ColumnDefinitions.Remove(item); _tableDefinitionModel.Definition.ColumnDefinitions.Insert(currentIndex + stepDir, item); Update(); SelectedItem = Rows[currentIndex + stepDir]; _tableDefinitionModel.TriggerUpdates(); }