void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.root = ((DataGrid.View.MainWindow)(target)); return; case 2: this.CurrentTime = ((System.Windows.Controls.TextBlock)(target)); return; case 3: this.AppointmentTable = ((DataGrid.View.AppointmentDataGrid)(target)); return; } this._contentLoaded = true; }
/// <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); }