I'm working with the Actipro Docking library and open source Prism integration lib. I was wondering if someone could help direct me on the best way to accomplish what I'm trying to do.
- I want to use ViewModel first pattern in my code. I would like to create a ViewModel add that to a IRegion in Prism and have a DataTemplate in my resources create the View
- I do not want to implement Actipro prism integration interfaces in my ViewModel (IDockingWindowInitializer, IDockingWindowItemTypeProvider). I want to be able to swap UIs and not have my ViewModels rely on Actipro's library.
- I would like to have my application's logic continue to use Prism's regions (IRegion interface). Again, just to keep maximum flexibility
Here's the problems I'm facing...
- If I create a ViewModel and add it to a DockSiteRegion through Prism, nothing is displayed because my ViewModel doesn't implement IDockingWindowInitializer, IDockingWindowItemTypeProvider, which I explicitly do not want to do. I do not want to use these interfaces, because I likely have to wire to many UI events and implement UI specific commands (Float, Dock) for my base DockingWindow class. This is code that should not be in the ViewModel
- Another alternative, I tried was to create a "DockingWindowHost" class which implemented those interfaces. It had a ContentControl with Content="{Binding}". This allowed resolution of the DataTemplate for each ViewModel normally with WPF. But, to use this class I had to create my own service, and do something like "IDockingService.AddDocument(myViewModel)". The service would then resolve the prism region and create the DockingWindowHost, set the DataContext, and add it to the region. However, this still makes all my ViewModels dependent on some docking service, and I wanted to keep it relying on a normal IRegion within Prism.
- I tried completely ignoring IDockingWindowInitializer, IDockingWindowItemTypeProvider... and using my DataTemplate to wrap MyView inside a DocumentWindow, but I'm not sure what I would need to do to make it display the Window in the docksite. I added my ViewModel to my region, that should resolve the Template which has a root control of DocumentWindow... but then that never actually "opens". I'm not sure where I could open that either
- Whatever solution I have, I still need to be able to handle DragDrop onto TabPage Tabs and also be able to bind the DocumentWindow.Title to a property in my ViewModel
I'm looking for anyone that I can have a discussion with on the best implementation that meets my goals..
[Modified 12 years ago]