Exemple #1
0
        private void DeleteTask()
        {
            if (ListViewToDo.SelectedItem == null)
            {
                return;
            }
            var deleteBoxResult = MessageBox.Show("Delete this item?", "Delete?",
                                                  MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No);

            if (deleteBoxResult == MessageBoxResult.Yes)
            {
                ToDoList.DeleteItem(ListViewToDo.SelectedItem as ToDoItem);
            }

            ListViewToDo.Items.Refresh();
        }
 private void Delete_Click(object sender, RoutedEventArgs e)
 {
     if (lvToDo.SelectedItem != null)
     {
         MessageBoxResult del = MessageBox.Show("Delete this item?", "Delete?", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No);
         if (del == MessageBoxResult.Yes)
         {
             tdl.DeleteItem(lvToDo.SelectedItem as ToDoItem);
         }
         lvToDo.Items.Refresh();
     }
 }