POCO View Binding

Sep 17, 2010 at 6:29 AM

In your demo from Mix you used a GameDTO object and had a corresponding GameView to display it. I tried a similar thing using the Caliburn Micro framework and it fails to locate a view for a POCO that isn't a view model (i.e. doesn't live in the ViewModels namespace and isn't named <xxx>ViewModel.

Other than modifying the ViewLocator to add custom logic to handle views for non-viewmodel objects, is there a new way to do this POCO view binding using the new framework or do we just revert back to wiring up the bindings ourselves?

Coordinator
Sep 17, 2010 at 2:12 PM

The best approach is to modify the ViewLocator.LocateForModelType func. In the original GameLibrary sample I had a custom bit of code for the GameDTO scenario as well. Think about what rules makes sense for your specific project and just put those into the Locator. If you need something really generic, you could create a custom attribute for VMs that you search for in the locator. We have that in the full version of Caliburn for example. It's pretty easy to tack on some simple stuff like this...so let me encourage you to customize things in any way that makes development easier for your project.