This project is an implementation of MVVM in WPF that works with loose XAML.
The project is called Xtreme MVVM as there does not need to be a reference from the View to the ViewModel or vice-versa. All bindings, events and routed commands are resolved at runtime.
The Unity framework, from Microsoft's Patterns & Practices
team, was chosen because it is unique in offering the ability to configure it in code or in a configuration file. I
like the option of configuring dependency injection with a configuration file as it allows for a single build to be "blessed" for release by QA using mock objects and then by changing the values in a text file, inject the "real"
objects (no new build required
!). You can try this out in the sample app by changing the .config file in the appropriate <BIN> directory.
1. Build and run the sample app
2. Change the line in the appropriate .config file from:
<register type="ICustomer" mapTo="SampleModel.Customer, SampleModel" />
<register type="ICustomer" mapTo="SampleModel.MockCustomer, SampleModel" />
3. Run the app again
You'll see the difference in the default values in the text boxes demonstating the ICustomer interface is being resolved to the MockCustomer object instead of the Customer object.
This is the first release of this framework, so the documentation is not yet available, but the ZIP file in the downloads section contains both the framework source as well as the source for a sample app that demonstates how to use the framework using data
binding to dependency properties, event handlers and routed commands.
If you look at the framework, you'll note that the values for dependency properties are set with the framework instead of directly. This is so multi-threaded apps can set the values. In testing this framework it was able to read values off a bar code reader
via the COM port at more than 20 bar codes per second and update the UI accordingly.