Multiple Views Per ViewModel

Jul 9, 2010 at 6:03 AM

Is it possible to have a ViewModel that has multiple Views?  For instance, someone wants to show the same set of data in different Views?

Jul 9, 2010 at 6:37 AM

Check out the View.Context attached property, the Caliburn documentation for this is here. Ignore the bit about ViewAttribute, looks like that isn't in Micro, you want to use the namespace conventions.

Jul 9, 2010 at 3:27 PM
Yup. View.Context is the way to go. You can also read about it in the description of the ViewLocator in the introduction to Caliburn.Micro here:
Jul 9, 2010 at 4:10 PM
Edited Jul 9, 2010 at 4:34 PM

I really like what I see in Caliburn (and the new Caliburn Micro) projects.

The only thing that is sort of a stumbling block for me is the ViewModel First approach. I like it from an architecture perspective, but I'm wondering how this plays out from a tooling perspective and the "Blendability" aspect.

What is the community perspective on handling this concern? What is the recommended approach for working with Views in VS or Blend?

- Nathan

Jul 9, 2010 at 4:20 PM
Edited Jul 9, 2010 at 4:21 PM
Actually with Blend 4's new "Create Sample Data From Class" and design-time DataContext features, it is very Blendable. I used Rob's original MIX10 framework on a prototype WP7 application and the designers and I were able to design every view in Blend with sample data.