// This event handler is fired when the add button is clicked. It adds a selected activity to the list of activities a group // is participating in private void BtnAdd_Click(object sender, RoutedEventArgs e) { try { int activityID = ((GroupActivityVM)dgGroupActivities.SelectedItem).ActivityID; if (_activityManager.AddGroupActivity(activityID, _groupID)) { MessageBox.Show("Activity added to " + _groupID + " group."); populateGroupActivities(); } } catch (Exception) { MessageBox.Show("You must select an activity first"); } }