private void MoveSlideUpButton_Click(object sender, RoutedEventArgs e) { if (SlideButtonsListBox.SelectedIndex > 0) { //UI ListBoxItem listBoxItem = SlideButtonsListBox.SelectedItem as ListBoxItem; int index = SlideButtonsListBox.SelectedIndex - 1; SlideButtonsListBox.Items.Remove(listBoxItem); SlideButtonsListBox.Items.Insert(index, listBoxItem); SlideButtonsListBox.SelectedIndex = index; SlideButtonsListBox.Focus(); //Data Presentation.RemoveSlide(CurrentSlide); Presentation.InsertSlideAt(index, CurrentSlide); } }
public void RemoveSlide() { if (Presentation.Slides.Count == 0) { return; } //Remove From Presentation Presentation.RemoveSlideAt(SlideButtonsListBox.SelectedIndex); //Remove UI ListBoxItem listBoxItem = SlideButtonsListBox.SelectedItem as ListBoxItem; SlideButtonsListBox.Items.Remove(listBoxItem); if (SlideButtonsListBox.Items.Count != 0) { SlideButtonsListBox.SelectedIndex = SlideButtonsListBox.Items.Count - 1; } SlideButtonsListBox.Focus(); UpdateDisplay(); }