Creating a user control library

Apr 4, 2011 at 4:35 AM

First, I apologize if my question doesn't completely make sense--I am fairly new to both MVVM and dependency injection.

I'm re-writing one of my older applications to utilize Autofac and Caliburn Micro.

For many components in my views, I would like to use re-usable UserControls. I'd ideally like my library of user controls to follow an MVVM pattern as well.

Is it possible to create a separate class library of UserControls (Views and ViewModels) based on Caliburn.Micro which can plug in to my larger application?

I don't really understand how Caliburn.Micro will instantiate the right ViewModel for each UserControl and wire up the right data to the ViewModel, especially if the ViewModel has generic type arguments (DataGridViewModel<T>).

How do I get data from my main application's model into the UserControl via its ViewModel? Would I use DependencyProperties to bind the data to my UserControl, which is then bound to the ViewModel for the UserControl, or is that backwards?