// Dependency: EIV.UI.UserControlBase private void mnuLocalidad_MouseDown(object sender, MouseButtonEventArgs e) { Menu.Hide(); // Este nombre debe ser univoco (por lo menos dentro del mismo assembly) Type formType = this.formService.FindFormulario("EIV.UI.Formularios.Localidad.LocalidadABM"); if (formType == null) { MessageBox.Show("Recurso no encontrado.", "Localidad", MessageBoxButton.OK, MessageBoxImage.Error); return; } // Testing ... 2017-08-02 this.formService.RenderFormulario(formType); return; object[] argValues = new object[] { this.formService }; // "No hay constructor sin parámetros definido para este objeto." IUserControlBase userControl = Activator.CreateInstance(formType, args: argValues) as IUserControlBase; userControl.Initialize(); // this.CreateNewWindow(userControl.MainInterface); this.CreateNewRadWindow(userControl.MainInterface); }
public MainWindow() { InitializeComponent(); // change the path here Assembly userControlAssembly = Assembly.LoadFrom("C:\\msys\\1.0\\src\\temp\\EIV.UserControl.Ejemplos.dll"); if (userControlAssembly != null) { this.testUserControl1 = Activator.CreateInstance(userControlAssembly.GetType(USER_CONTROL_TYPE)) as IUserControlBase; if (this.testUserControl1 != null) { this.testUserControl1.Initialize(); // It should show the user control here this.contentControl.Content = this.testUserControl1.MainInterface; } } }
// Parece rebuscado! public UserControlViewModel(IUserControlBase concreteForm) { this.viewModelConcreteForm = concreteForm; this.testContent = new ObservableCollection <object>(this.viewModelConcreteForm.GridContent); }