private void Button_Click_1(object sender, RoutedEventArgs e)
 {
     // selecteditems cannot be bound, so get selection here instead
     List<LocalCalendarEvent> selectedEvents = new List<LocalCalendarEvent>();
     foreach (LocalCalendarEvent gridEvent in Calendar1Events.SelectedItems)
     {
         LocalCalendarEvent newEvent = new LocalCalendarEvent();
         newEvent = (LocalCalendarEvent)gridEvent;
         if (newEvent != null && !selectedEvents.Contains(newEvent))
             selectedEvents.Add(newEvent);
     }
     if (selectedEvents.Count > 0)
         _viewModel.TransferEvents.Execute(selectedEvents);
 }
 private void Delete_Click(object sender, RoutedEventArgs e)
 {
     Button clickedButton = (Button)sender;
     if (clickedButton != null)
     {
         List<LocalCalendarEvent> selectedEvents = new List<LocalCalendarEvent>();
         if (clickedButton.Name == "DeleteButton2")
         {
             foreach (LocalCalendarEvent gridEvent in Calendar2Events.SelectedItems)
             {
                 LocalCalendarEvent newEvent = new LocalCalendarEvent();
                 newEvent = (LocalCalendarEvent)gridEvent;
                 if (newEvent != null && !selectedEvents.Contains(newEvent))
                     selectedEvents.Add(newEvent);
             }
             if (selectedEvents.Count > 0)
                 _viewModel.DeleteAppt2.Execute(selectedEvents);
         }
     }
 }