We have a (massive) legacy WinForms app which, through a menu item, opens up a WPF form. This WPF form will host an Infragistics grid, and some buttons/drop-downs.
This lone WPF form represents the nascent stage of a migration to WPF. Later on, more components of the app will move to WPF, and ultimately the entire app itself.
As part of the migration, we would like to use Caliburn Micro. Hence, it would be nice if we could start by using it with this lone WPF form.
- Can someone please provide some pointers on how to use Caliburn Micro with the WPF form?
- Or perhaps tell me why it may not make sense to use Caliburn Micro just yet?
The documentation I’ve read so far involves boot strappers that ensure the application starts with the desired root view model, rather than the scenario above.
Many thanks!
After much Googling and going through the Caliburn Micro source code, I’ve come up with an approach that works in a sample test application. I can’t post the test application here for certain reasons, but here’s the approach in a nutshell.
In the load handler of the ChildWinForm:
The bootstrapper above is something you’ll have to write.
It should do the following in its constructor:
Last thing to note is that you’ll have to set the cal:Bind.Model dependency property in the XAML of WpfControlView.
The value of the dependency property is used passed as a string to Bootstrapper.GetInstance(Type serviceType, string key), which must then use it to resolve the WpfControlViewModel.