/// <summary> /// User clicks on unit /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Units_List_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (Units_List.SelectedIndex != -1) { //get unit code from selection and send to list controller to get full details Unit item = (Unit)Units_List.SelectedItem; //populate timetable user control Units_TimeTable.TimeTable = Lists.GetTimeTable(item.unitcode); //hand over the StaffDetails user control for it to use Units_TimeTable.alternative_user_control = Units_StaffDetails; //Hand over current list controller instance Units_TimeTable.Lists = Lists; //Reste the visibiliy of controlls Units_TimeTable.Visibility = Visibility.Visible; Units_StaffDetails.Visibility = Visibility.Collapsed; } else { //no selected staff in list so hide staff details //*DISABLED THIS FEATURE FOR NOW (could be bad for the cra)* Staff_Details.Visibility = Visibility.Collapsed; } }
private void unitsInvolved_Grid_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (unitsInvolved_Grid.SelectedIndex != -1 && Back_Button.Visibility == Visibility.Collapsed) { //get employee id from selection Unit item = (Unit)unitsInvolved_Grid.SelectedItem; //populate timetable with class details.. alternative_user_control.TimeTable = Lists.GetTimeTable(item.unitcode); //change the display... alternative_user_control.Visibility = Visibility.Visible; this.Visibility = Visibility.Collapsed; //reset selection so that after clicking back they can click the same unit again for the same result. unitsInvolved_Grid.SelectedIndex = -1; } }