private void AppointmentListView_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e) { var item = (sender as ListView).SelectedItem; if ((IVisit)item != null) { ScheduledAppointmentEventArgs args = new ScheduledAppointmentEventArgs(ScheduledAppointmentEvent, (IVisit)item); RaiseEvent(args); // This event is caught in Appointments.xaml.cs: AppointmentDataGrid_ScheduledAppointment } }
/// <summary> /// This Handles the ScheduledAppointment event of the AppointmentDataGrid control. This event is triggered when an item selection is made. /// This is XAML bound in Appointments.xaml /// <customcontrols:AppointmentDataGrid ...customcontrols:AppointmentListView.ScheduledAppointment ="AppointmentDataGrid_ScheduledAppointment"... /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="args">The <see cref="ScheduledAppointmentEventArgs"/> instance containing the event data.</param> private void AppointmentDataGrid_ScheduledAppointment(object sender, ScheduledAppointmentEventArgs args) { AdornerClose(); AppointmentDataGrid fe = (AppointmentDataGrid)sender; ((ICloseable)DataContext).RequestClose += Appointments_RequestClose; // The appointmentKey comes directly from the selected listview element. IVisit visit = (IVisit)args.appointmentKey; // Must set the selected visit in the AppointmentEditor before the bindings of the adorner bind it to the DataGridAnnotationControl. // RaiseCommand here causes the "Command" (defined below) of the Appointments.XAML to call the RelayCommand via the DoctorView.Xaml. // The Command Target is SelectedVisit is the AppointmentEditor.cs. RaiseVisitCommand(visit); // Creation of the adorner will create the DatGridAnnotationControl and immediately create the bindings. _adorner = new DataGridAnnotationAdorner(fe); // put adorner into the adornerlayer. InstallAdorner(fe, _adorner); }
/// <summary> /// This Handles the ScheduledAppointment event of the AppointmentDataGrid control. This event is triggered when an item selection is made. /// This is XAML bound in Appointments.xaml /// <customcontrols:AppointmentDataGrid ...customcontrols:AppointmentListView.ScheduledAppointment ="AppointmentDataGrid_ScheduledAppointment"... /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="args">The <see cref="ScheduledAppointmentEventArgs"/> instance containing the event data.</param> private void AppointmentDataGrid_ScheduledAppointment(object sender, ScheduledAppointmentEventArgs args) { }