What’s that I hear, you can’t do PRISM in Winforms.
Well it’s possible – to an extend. Even in .NET 2.0 – an utterly ludicrous constraint placed upon us poor developers by a supposedly all knowing upper eschelons of management.
So I’ll give you a tease of how I done it.
First take Brian Noyes Code http://www.softinsight.com/bnoyes/2008/10/13/CompositeExtensionsForWindowsForms.aspx.
This doesn’t include support for regions. I added it by taking code from prism 4 and tuning it for WinForms. This included adding adaptors for tab controls and panels – fits in very nicely with the prism pattern and easy to add in via the bootstrapper. For commanding under .net 2.0 create your own delegates! That is what a command is.
The big downfall is binding. Somewhat manual still but done enough with Winforms bindings and the IDataError, INotifyPropertyChanged interfaces supplied in .net 2.0 (or earlier). All done with an interface so easy to switch put for other envs like Silverlight. Converting to silverlight later on was relatively straight forward – but not doing the async pattern hurt.
Doing Behaviours and Interactivity which was introduced in Silverlight 3 is just a little too far to go. I used the patterns that worked that worked with version2 and below – that is interact with an interface and let the view do the heavy lifting.
I don’t think I’ll have have to do this again!