This project is read-only.

Cinch V1 Documentation

Cinch V1 is a MVVM framework that provides a number of attached behaviours/UI services and a number of helpers. It was aimed at writing highly testable ViewModels that were written by inheriting from well designed Cinch v1 base ViewModels where a lot of the work had already been done for the user. Cinch V1 used the Unity DI/IOC container out of the box, but could be made to work with any other IOC container fairly easily.

It had several UI services and also provided test doubles for these services, the following core services are available within Cinch V1
  • Logging Service
  • MessageBox Service
  • Open File Service
  • Save File Service
  • Popup Window Service

It was written for VS2008 and was written before Microsoft formalized a lot of the things WPF developers were already doing. As such since Cinch V1 was released there are better ways to do a few things. Cinch V2 however makes use of all the newer features that are now available both in the Blend Interactivity Dll and the .NET 4.0 Dlls.

Cinch V2 Documentation

With Cinch V2, I swapped out the standard IOC container support for the use of Managed Extensibility Framework (MEF), and I also took a dependency on the fabulous MEFedMVVM project by my good friend Marlon Grech. Marlon did an amazing job with MEFedMVVM and it is thanks to MEFedMVVM that Cinch V2 is able to offer such great design time support for services.

I also took the time to try and create a View 1st workspace arrangement for WPF, and update all attached properties to use the newest best practices of using the Blend Interactivity Behaviours/Triggers/Actions.

The following are now available in Cinch V2 where these replace the Cinch V1 attached behaviour DPs, and there are some new ones too.

  • NumericTextBoxBehaviour (WPF Only)
  • SelectorDoubleClickCommandBehavior (WPF Only)
  • TextBoxFocusBehavior (WPF Only)
  • CompletedAwareCommandTrigger
  • CompletedAwareGotoStateCommandTrigger
  • EventToCommandTrigger
  • CommandDrivenGoToStateAction

At the same time I also made Cinch support Silverlight 4 or above. Cinch V2 offers many of the same features that Cinch V1 one had, like the choice of ViewModel base classes, and DataWrapper, and there are some services which were fine in Cinch V1, that have simply been made available via MEF. This is good for everyone as these are good features that worked just fine. What is new is that there are a number of new services, and as I stated there is now support for design time data, and for Silverlight of course. I have not discussed Unit testing in any of the new Cinch V2 material, as it has largely stayed the same as Cinch V1, though where I have introduced new services I have also included new test doubles (essentially pre built mocks for you to use) in the Cinch V2 codebase.

A Few Notes About BLEND

One user reported some strange issues using MefedMVVM and Cinch together with Blend, and was getting multiple contract imports occurring. This ended up being down to BLEND keeping a cached copy of some Dlls in a cached folder. This is one gotcha that I thought I should write down here in case anyone comes across it.

So if you find MEF catalog issues please do the following 2 things:
  • Ensure the Blend cache is cleaned up, the location of which may vary depending on what OS you are running. I am running Win7 and for me that is located here : " C:\Users\barbers\AppData\Local\Microsoft\Expression\Blend\Project", but for the reporter of the error this was located at "C:\Users\xxx\AppData\Local\Microsoft\Expression\Blend"
  • Another gotcha is if you are working with references, you may come across MEF errors then too, you can see Marlons blog for a solution to this, which involves "CopyLocal=false" fix, see Marlons Blog MEF DeploymentCatalog and Reference assemblies

Cinch V2 Related Demo Articles

Cinch V2 Working With PRISM 4

Since the introduction of Cinch V2 and the latest release of PRISM (which uses MEF) Cinch V2 and PRISM can work together very easily, as such I have created a couple of demo applications which show case Cinch V2 working with PRISM 4 features like Regions/Module. The links below will talk you through that, and you can see what the 2 demo apps look like on the Cinch Home page here at codeplex.

Cinch V1/V2 Common Code Generator Documentation

There is a code generator application that can be used to create CinchV1/V2 ViewModels. It was originally written for Cinch V1, so you will find it in the CinchV1 folder in the source code. Below is a list of the documentation for the code generator

Last edited Aug 23, 2011 at 3:28 PM by sachabarber, version 18


No comments yet.