WPF Support Timeline

Topics: CAB & Smart Client Software Factory
Sep 22, 2006 at 2:44 PM
originally posted by: kentcb

Hi,

Is it possible to get an estimated timeline for WPF support within CAB? It really would be nice to know if anyone is working on this and how far off it is from fruition.

Thanks,
Kent Boogaart
Sep 22, 2006 at 5:06 PM
originally posted by: askew

You can start using the RC1 of .NET 3.0 now.
Here's how to start experimenting WPF on XP with CAB (using SCSF and MVP):

0) Download the .NET 3.0 RC1 and SDK and install them. Get them from here:

http://msdn.microsoft.com/windowsvista/downloads/products/getthebeta/

1) Add References in the Module projects which contain the Views (SmartParts) you want to host WPF controls:

PreesentationCore
PresentationFramework
WindowsBase
WindowsFormsIntegration

2) Add these using statements to your View (SmartPart):

using System.Windows.Forms.Integration;
using System.Windows.Controls;

3) To avoid ambiguity, you must change the inheritance of your SmartPart to be explicitly derived from System.Windows.Forms, like this:

SmartPart
public partial class View1 : System.Windows.Forms.UserControl, IView1

4) Put this code in your View's (SmartPart's) OnLoad event:

ElementHost host = new ElementHost();
System.Windows.Controls.Button myButton =
new System.Windows.Controls.Button();
myButton.Content = "Avalon Button";
host.Child = myButton;
host.Dock = DockStyle.Fill;
this.Controls.Add(host);

5) Don't forget to put code in your 'ModuleController.cs' to load the View. Remember I use the SCSF CAB, so I put this code in the 'AddViews()' method:

View1 view = WorkItem.SmartParts.AddNew<View1>();
WorkItem.WorkspacesConstants.WorkspaceNames.LeftWorkspace.Show(view);


You should see "Avalon Button" filling the LeftWorkspace of your CAB solution.

It's only as far away as the .NET 3.0 release. The only change from the last WPF release is the use of "host.Child" versus "host.Controls.Add()", as far as I can tell. This should be kept in mind; there may be slight tune-up changes to WPF, but I'd bet on what exists today is ok.

Thanks for asking Kent!
Sep 22, 2006 at 5:39 PM
originally posted by: kentcb

Thanks for the reply, but I am after pure WPF support - not a winforms integration approach. Our app is brand new and is implemented entirely in WPF - no winforms.

What I'm wondering is when there will be a Microsoft.Practices.CompositeUI.Windows assembly that contains WPF workspaces and what-not.

Thanks,
Kent
Sep 22, 2006 at 6:12 PM
originally posted by: askew

That would be .NET 3.5, then, right?

The VS2007 with LINQ version?

Do you anticipate a performance hit with 'Crossbow'?

?
Sep 22, 2006 at 6:15 PM
originally posted by: kentcb

No, we are using .NET 3.0. Our app leverages WCF for communications and WPF for presentation. I'm confused - why do you assume .NET 3.5?

I am not worried about crossbow performance - I am merely trying to keep our code base as simple as possible. It seems silly to introduce a winforms dependency and host objects just to use CAB, when CAB can theoretically support WPF "natively".

Thanks,
Kent
Sep 23, 2006 at 8:09 AM
originally posted by: ChrisHolmes

CAB is built on Windows Forms because most CAB applications implement the WindowsFormsApplication class.

Now, the creators of CAB did build a hierarchy that goes all the way up to a generic CabApplication class, which means that theoretically one could subclass that and develop a WinFX solution, but that still doesn't address all of the infrastructure built into the CAB to support Windows Forms.

Take a look at the class libraries. Microsoft.Practices.CompositeUI.WinForms. There's a lot of code devoted to WindowsForms that make the CAB MVP architecture work. A lot of the core components are implemented in that WinForms, like all the Workspaces, etc.

One could write a new library to support WPF, but I imagine it would take some serious time.
Sep 23, 2006 at 1:07 PM
originally posted by: kentcb

Thanks Chris. I have indeed already had a look at this code because I was interested in how difficult it would be for me to implement my own WPF support layer. What I'd like now is an indication from the CAB developers as to whether they plan to do this or not. It's hard for me to plan what to do in my application without this information.

Thanks,
Kent
Sep 29, 2006 at 8:32 PM
originally posted by: askew

I just found Crescendo, an OSS for a version of CAB built on WPF:

http://crescendo.solersoft.com/Home/tabid/53/Default.aspx

This blog lead me to it:

http://mdavey.wordpress.com/2006/09/19/cab-wpf/

Kent, I would think .NET 3.5 due to the amount of work involved to re-write CAB and SCSF plus the full plate that P&P seems to have with Web Client Software Factory. Guidance for LINQ might be a part of it, but I don't know their plans. I do know they listen to us. There is a survey for prioritizing changes to CAB's modules for isolation from the shell, so I would imagine they will be back in the CAB code soon. It would be great to have a Vista version, perhaps it isn't as difficult as it seems. The extra work required for using Crossbow today is worth the effort to reach the XP market for our shop. I'm optimistic that moving Crossbow - CAB to WPF - CAB will not be too hard for our team.
Sep 29, 2006 at 8:33 PM
originally posted by: askew

duplicate post
Sep 30, 2006 at 11:27 AM
originally posted by: ChrisHolmes

Very cool link Askew. You touched on something I was also thinking: the P&P team seems to be busy with the new Web Client Software Factory, so it's difficult to say how soon it will be before they can get back to CAB changes.

One question I had about this, since we had to make this same decision (and for now we're going with Forms, although we will revisit this again and again as Vista approaches), but: what do people think about the 3rd party tools available for WPF? We're using Infragistics right now, for example, and I am completely unsure what kind of WPF support they will have when Vista ships.

How are the rest of you folks who are wanting to develop for Vista approaching this? What are your thoughts?
Oct 3, 2006 at 1:28 PM
originally posted by: kentcb

Thanks for the links Askew.

Chris, our approach is to wait and see. I'm hopeful that a whole slew of commercial libaries will be released for WPF when .NET 3 RTMs. I suspect that component vendors are already working on WPF-enabling their products but won't release until then.

Kent
Oct 5, 2006 at 1:46 AM
originally posted by: mcgomer

I posted this in one of the other forums recently, but it seems appropriate here too.

The first thing I would expect is that the CAB compiles, and runs cleanly with whatever the latest version of .Net and c# is. I do not want to be orphaned with the current version of c# and .net.
A port to the latest versions of both should be done with the availability of beta versions of the tools so that there are no surprises. This should be a point release of the existing CAB.

Second. After the port, do simple enhancements to take advantage new things within the new environment. With this, I mean the next step beyond a simple port. For instance, if this had been a move from 1.0 to 2.0 I would add generics into the CAB at this point, not in the port. For the port I would have used the existing collection classes, not generics. This should be a point release of the existing CAB.

Third. After step two is available to the world, look at paradigm shifts that have occured with the new technologies. ie Xaml, workflow, linq, changes to the WPF paradigm, and whatever else makes sense within the charter of the CAB. Then apply them as needed into a new version of the CAB not a point release.

I would not try to add more functionality into CAB and turn it into the be all to end all. Make it lean and mean. Enhance performance and usability, not neccessarily functionality. It is a framework for a smart client, not the smart client. Make sure the abstractions that the CAB represents make sense and are simple to enhance by the user. Create other project to add functionality. Look at the Apache model with the web server, tomcat and then all of the other projects that have been spawned off of that. Dont get seduced into putting everything into the same project.

Just my 2 cents

So, to keep it in the context of the current thread, I would create a point release that uses windows forms but works well with c# 3.0. Include whatever is needed for crossbow support in that release. People who have invested in the current CAB need a path into 3.0 and Vista with WinForms support.

Then I would look at what a true CAB for Vista/WPF really means. We need one IMO as soon as possible, but make it a new release. Also use the opportunity to understand how to make CAB truly view technology agnostic, and do it. We can have both versions. Again, look at how the Apache Projects run their point releases and then also develop new versions that do complete paradigm shifts when the underlying technology shifts.


And to answer your "Controls" questions. The only safe path IMO is to use the microsoft controls as much as possible. Where there is a justifiable need to use a third party control, you do, but with the understanding that that control may have to be replaced, or "lag" until the vendor issues a version that works with the current OS release.

Paul