Can MVVM FX work with MID container?

Oct 19, 2015 at 5:16 PM
Edited Oct 29, 2015 at 8:02 PM
I have an old project in winforms and use MDI container to host all the forms inside.
Basically when the user click the menu item, I assign a new form to the mid container and display to the user.

I mainly want the winform UI view to bind in a mvvm way to the viewmodel so that i can upgrade to WPF in the future when have a chance.

Thanked in advanced!
Oct 28, 2015 at 8:38 AM

I never tried the specific MDI scenario but I can't see no reason why it won't work.
Oct 29, 2015 at 8:06 PM
tiago wrote:

I never tried the specific MDI scenario but I can't see no reason why it won't work.
Hi tiago,
Thanks for the relpy!
following is the typically way to open a new form when called.
var fm = new ChildRibbonForm();
fm.MdiParent = this; (or MDIRibbon.ActiveForm);

But the navigation of the UI of caliburn.micro and the MVVM pattern are viewmodel driven. So they are really not compatible by design i assume?

Nov 1, 2015 at 12:23 PM
Edited Nov 1, 2015 at 12:27 PM
Hi Anthony,

FIrst of all, if you haven't done so, please take a good look at two samples:
  • BoundTreeView as a generic sample that shows the implicit use of WindowManager. In fact the WindosManager is never explicitly called but behind the scenes CaliburMicro takes care of this operation, whenever you instantiate a new FamilyMemberEditViewModel() as in the GetFamilyMemberEdit() method. The instantiation tells the framework to open the FamilyMemberEditView form. And that's it.
  • CslaSample for an example of explicit use of the WindowsManager. On the EditFoldersModeless() method the WindowsManager ShowWindow() method is used to explicitly instruct the framework to show modeless form of the type FolderListEditView.
Presuming your MDI form is called ChildRibbonView and your viewModel is called ChildRibbonViewModel, to instantiate a new MDI form you should use WindowManager().ShowWindow(new ChildRibbonViewModel()).