Wednesday, October 04, 2006

WPF + CAB


NOTE: this project has been superseded by - and rolled into - the SCSFContrib
project.

I didn't really want to have to do this, but here is a WPF layer for the Composite Application Block (CAB). Sure, I could use Crossbow [^] and leverage the existing Winforms layer in CAB, but why should I complicate my implementation when CAB is designed to be view technology-agnostic?

I will update this post as the feature list below changes. Hopefully I don't get in trouble for including MS code in my download . . .

You can download the code here. If you'd like to use CAB with an XBAP application, check out Martijn's post here [^].


SCREENSHOTS OF BANKTELLER SAMPLE



HISTORY

V1.0 (9th of December, 2006)
- Moved hosting to CodePlex here

V0.7 (8th of November, 2006)
- Changed ZoneWorkspace to work with ContentControls only, since that makes more sense and makes the implementation easier
- Got rid of all the CVS control files in the download
- Applied for a CodePlex project in which to host this project

V0.6 (4th of November, 2006)
- Added XmlnsDefinitionAttributes for better XAML integration
- Fixed bug in ZoneWorkspace
- Other trivial improvements

V0.5 (21st of October, 2006)
- Added visualizer support and a sample visualizer (a work item visualizer). The sample project starts up with the visualizer on by default.
- Cleaned up the FrameworkElementSmartPartStrategy code to use LogicalTreeHelper.
- Enhanced the zone workspace.
- Added an API summary to most classes.

V0.4 (14th of October, 2006)
- Fixed ApplicationShellApplication, which allows you to start a CAB application up with a WPF Application instance as a shell.
- Modified the example project to use the ApplicationShellApplication instead of WindowShellApplication. In reality, you'd probably use the latter for such a project. However, ApplicationShellApplication is harder to use so I thought I'd demo that.
- Added the ability to set the owner of a window in the WindowSmartPartInfo.

V0.3 (7th of October, 2006)
- Fixed activation service (works against FrameworkElements now instead of UIElements)
- Bug fixes and enhancements to builder strategies
- Bug fixes and enhancements to UI adapters
- Bug fixes and enhancements to workspaces
- Added SmartPartPlaceholder control
- Added WPF version of the BankTeller sample (screenshots above)

V0.2 (5th of October, 2006)
- Improved command support
- Improved window smart part info (allows wider choice of how to display windows when using the window workspace)
- Fixed some bugs
- Minimised the extra crap in the download

V0.1 (4th of October, 2006)
- Window workspace (show smart parts in separate windows)
- Tab workspace (show smart parts in a tab control)
- Deck workspace (show smart parts on a “deck” – one smart part visible at a time)
- Zone workspace (show smart parts in a particular zone)
- Command support for menus (WPF menu items can be associated with CAB commands)
- Window shell application (start a CAB WPF application by giving the main window)
- Application shell application (start a CAB WPF application by giving the WPF application type) – I don’t think this actually works

Keywords: WPF, CAB, Windows Presentation Foundation, Composite Application Block, Microsoft.Practices.CompositeUI.Windows

15 comments:

Anonymous said...

Hi,

that's really great - keep on working on that.

Anonymous said...

Man, this is great work!
A lot of people are looking for this kind of CAB/WPF integration (other than crossbow).

Anonymous said...

Hi Ken,

No matter what I do, the archive is corrupted after I download it..

Kent Boogaart said...

Hi,

Hmm, by the looks of it the upload didn't complete successfully (there were a few bytes missing from the end of the file). I've just uploaded a fresh copy. Can you try again please?

Thanks,
Kent

Anonymous said...

Hi Kent,

Works OK now, thanks.

Martijn Hoogendoorn said...

Hi Kent,

The port doesn't quite function for XBAP applications. I've modified the ApplicationShellApplication to remove the .Run() because that's not allowed. It starts, and sort-of works, but the menu items don't get registered properly...

Martijn Hoogendoorn said...

Could you contact me per e-mail? martijn#hoogendoorn#macaw#nl (replace # with ., @ and .)

Anonymous said...

Great work!! Thanks for doing the work when all of us are running a search in Google

Edjez said...

This is great work! Unfortunately I cannot look at the source (LGPL and all that) but I'm glad you have caught on the view agnosticity aspects. Please let us know how it goes, maybe we can't send code back & forth but we'd sure like to know what we can do to simplify your work!! Consider posting a link in www.cabpedia.com...

Kent Boogaart said...

Thanks Edjez - I've posted a link on cabpedia.

The source is probably not worth looking at, to be honest. At this stage I just needed something that works, so it's kind of hacked together. Hopefully later I'll get time to clean it up a bit, but only if P&P haven't released their own implementation.

edjez said...

By all means keep going with the effort! Please be loud and clear if there are annoying glitches in CAB or ObjectBuilder that get in your way - OB is in CodePlex as well now.

Jaco de Villiers said...

Thank you for a great starter.

Some questions:
1) My project does not resolve (PresentationDesignDeveloper)
2) I can not get the designer to work on most pages. Seems (clr-namespace:Microsoft.Practices.CompositeUI.Windows.Workspaces;assembly=Microsoft.Practices.CompositeUI.Windows) can not be resolved.
3) I am about to start on a prototype based on CAB using WPF, any comments before i start this adventurous process?

I have VS2005 Pro, CAB + Ent Lib in the GAC.

Regards
Jaco
(jacodv@gmail.com)

Kent Boogaart said...

Hi Jaco,

> My project does not resolve (PresentationDesignDeveloper)

This is part of the Cider design tools. On my machine it is at E:\Program Files\Microsoft Visual Studio 8\Common7\IDE\Cider\PresentationDesignDeveloper.DLL. To be honest, I'm not even sure how that got in the BankTeller project. I just removed it and it builds fine without it. You should be able to do the same.


> I can not get the designer to work on most pages. Seems (clr-namespace:Microsoft.Practices.CompositeUI.Windows.Workspaces;assembly=Microsoft.Practices.CompositeUI.Windows) can not be resolved.

The Cider designers are still very much in beta. They do not work with any 3rd party controls yet.

> I am about to start on a prototype based on CAB using WPF, any comments before i start this adventurous process?

First I will reassure you that the combination of CAB and WPF works quite well. I have been writing the UI for a very large and complex project at work of late and it is almost complete. The CAB side of things has gone really well.

The only thing I would suggest (and this is something I'm looking at right now) is to consider boycotting CAB's command infrastructure and just use the WPF one directly. CAB's command layer seems quite limited compared to WPFs and one thing in particular seems impossible: passing data into a CAB command.

For example, instead of just raising a command when the user clicks on an order, raising the command *and* passing the order into the command handler. This is possible with WPF but not with CAB it seems.

More on this as I look at it over the next couple of days (it's what I'm working on right now).

Anonymous said...

Hello I want to congratulate to them by its site of the Web of the exelente looks like entertained and very good very to me it elaborated. I invite them to that they explore a little on my site of the Web. Costa Rica Real State
In our real estate listing, we offer a great variety of land properties of all kind all over Costa Rica, from nice city houses, including condos, lots, country houses and farms, to splendorous luxury properties with extraordinary ocean views or located in front of the most beautiful beaches of Costa Rica.
But we don't just find those properties for you. We also give you all the legal advising regarding Costa Rica land properties regulations; our knowledge and expertise allow us to offer you a confident and dependable advice. Likely, we will advise you on how to make the best possible real estate investment anywhere in Costa Rica.

Our real estate listing includes great opportunities on Costa Rica Central Valley's provinces such as San Jose, our Capital, with remarkable cities as Escazu at the west, or Curridabat at the east, experiencing a great development on both commercial and residential properties, making their real estate pricing highly attractive to investors; on other hand, Alajuela city gathers places with a very special warm weather such as Grecia, La Garita and Atenas, or beautiful farms for agricultural, cattle or nature preservation purposes as those located on San Carlos or Sarapiqui. We also offer land properties in Guanacaste, which is the province, along with Puntarenas, with the most beautiful tropical beaches on the Pacific Coast such as Tamarindo, Playa Grande, El Coco, Playa Hermosa, Nosara, Samara, Herradura, Jaco, Manuel Antonio, Dominical and Golfito, where the real estate business occupies the first place as the local economic activity.
We can’t leave outside our real estate listing, land properties of great beauty on the Costa Rica Carribean Coast like Tortuguero, Limon, Cahuita, Puerto Viejo and Gandoca Manzanillo.

We invite you to take a tour on our website, and if should more information is required.
The best investment opportunity in Costa Rica: costa rica real estate, real estate beach,costa rica condos. Visit us for more information at: http://www.costa-ricarealestate.com

pedro velasquez said...

I'm starting a new project where we will be using Windows Presentation Foundation (WPF).
sportsbook I've done very little work with WinForms in the past, but from what I understand the Composite UI Application Block (CAB) is the way to go for WinForms development. I've also seen a few posts about integrating the two using crossbow. However,bet nfl I don't want to host WPF inside of WinForms, I want to use pure WPF.
So does WPF replace CAB as a UI framework or are there things in CAB that WPF is missing?
I haven't been able to find much on the subject so far. I'm just getting started on my project and still learning the WPF basics (and some CAB basics),http://www.enterbet.com so it is certainly possible that I'm just missing the obvious answer. Any feedback or suggestions are welcome