private void tbMoveDown_Click(object sender, RoutedEventArgs e) { var node = (IRepositionableChild)tvDetails.SelectedItem; IRepositionableChild selectedDay = node; if (selectedDay != null && ((TrainingPlanTreeItemViewModel)selectedDay).CanMoveDown) { selectedDay.RepositionableParent.RepositionEntry(selectedDay.Position, selectedDay.Position + 1); viewModel.SetModifiedFlag(); updateToolbar(); } }
private void tbMoveDown_Click(object sender, EventArgs e) { var node = tvDetails.SelectedNode; IRepositionableChild selectedDay = node.Tag as IRepositionableChild; if (selectedDay != null && node.NextNode != null) { selectedDay.RepositionableParent.RepositionEntry(selectedDay.Position, selectedDay.Position + 1); int index = node.Index; var parentNode = node.Parent; node.Remove(); if (parentNode == null) { tvDetails.Nodes.Insert(index + 1, node); } else { parentNode.Nodes.Insert(index + 1, node); } tvDetails.SelectedNode = node; } }