Public musings, often on software development RSS 2.0
# Monday, April 16, 2007

One of the items I learned when I was requested to speak to the LA C# User Group, was that they were essentially affiliated with the SoCal .NET User Group (http://www.socaldotnet.org/).  Apparently the same speaker coordinator works both groups and they meet one after the other.  Thus I was also requested to speak to the Orange Country group on the following night April 4th.  Since some people attend both meetings I agreed to adjust my topic slightly.

In this cas I adjust my presentation to focus on WPF and Interop.  The focus of course being the ability to take applications built with Windows Forms 2.0 and have the user interface work with new components being built with WPF.  The presentation again introduces .NET 3.0 and WPF but doesn't include much of the XAML focus from the previous night's presentation.  It instead spends more time looking at Crossbow.

Crossbow is the code name which Microsoft used when it was building the Interop libraries to allow the new WPF windows graphical libraries to work alongside the existing Windows.Forms libraries.  The key message was: if you are using the Interop controls, the WindowsFormHost and ElementHost controls should ALWAYS be used to host User Controls.  Yes they CAN host individual controls such as a TextBox or DataGridView, but if you need to Interop you have business logic in place and you should always encapsulate the controls in a User Control prior to having those controls placed in one of the Interop controls.

In addition I spoke about how this Interop direction is really a lesson learned from the initial Visual Basic 6.0 to Visual Basic .NET migration based path which Microsoft provided.  Microsoft learned that trying to take an entire real world application and migrate it's entire code base to a new implementation language was a cost prohibitive scenario.  It tended to be difficult for engineers to imagine and they constantly wanted to start with the backend components which made it that much more complex. 

Instead with WPF Microsoft has pursued an Interop strategy.  There won't be any tools to migrate your Windows Forms based application to a WPF UI.  After all many components such as the DataGridView control just don't have a single equivalent under WPF.  The key being that when you went to move the implementation from Windows Forms to WPF you'll want to change the implementation completely.

As I also note, not only did Microsoft learn this lesson when planning WPF, the Visual Basic Team has been leading the way.  They have released a set of tools which will allow you to create new .NET Forms and have these forms compile into classic VB6.0 applications.  In this way you can begin to extend your existing VB 6.0 applications with new .NET based capabilities without needing to spend 6+ months migrating your code base.  The new VB Interop tools although not the focus of this presentation are every bit as exciting as the WPF Interop tools.  You can get the latest version of the VB Power Tools from MSDN or from the Visual Basic Team blog at: http://blogs.msdn.com/vbteam/archive/2006/11/02/interop-roadmap-usercontrols-mdi-and-data.aspx

Here is a copy of my slides from the SoCal .NET User Group Presentation:

WindowsInterop.zip (992.07 KB)
Monday, April 16, 2007 2:15:42 PM (Pacific Daylight Time, UTC-07:00)  #    Comments [0] -
.NET | Technology | Visual Basic
Archive
<September 2010>
SunMonTueWedThuFriSat
2930311234
567891011
12131415161718
19202122232425
262728293012
3456789
About the author/Disclaimer

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Copyright 2010
Bill Sheldon
Sign In
All Content © 2010, Bill Sheldon