Doing PRISM in Winforms

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!

Cheers,

Nick

Advertisements

4 responses to “Doing PRISM in Winforms

  • Marcus

    What kind of people work at this place… What were they thinking… Unbelievable…. Most computing professional would not be so regressive. But nice to see you managed to go a win with PRISM in Winforms.

  • Dalton

    Could you publish a download link with the complete extension you created? it would be useful for may people, including that who use prism 4 and don’t want to upgrade Composite WPF Contrib to Prism 4.0.

  • nzdunic

    I no longer work for the company so unless I rewrite at home I wont be able to upload the code. I agreee the use of the RegionManager and Commands in the Winforms enviroment is useful. Folliwong the MVVM pattern is just as useful anyway 🙂

  • Nick

    On reflection, this was a reaction to some dishonest behaviour from the hiring company. To cut a long story short they were hiring for silverlight and we talikng as such. The day I started they switched to WinForms. They weren’t upfront and i should have walked away. Such disrespect should beget a similar response back. I’m take little solice in the idea that one person instrumental in the decision is shown up later after a monumental and costly stuffup.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: