private void button1_Click(object sender, EventArgs e) { mediControl = new MediControlViewModel { MedicationEntries = new System.Collections.ObjectModel.ObservableCollection <MedicationEntryViewModel>( CreateSampleEntry(1)) }; elementHost1.Child = new MediControl { DataContext = mediControl }; }
protected override void SetApplicationItem() { if (!this.bodyPanel.Controls.Contains(_wpfHost)) { var mediControl = new MediControlViewModel { MedicationEntries = new System.Collections.ObjectModel.ObservableCollection <MedicationEntryViewModel>( FormSample.CreateSampleEntry(200)) }; _mediControl.DataContext = mediControl; _wpfHost.Child = _mediControl; this.bodyPanel.Controls.Add(_wpfHost); } }