WPF grid: where the bleedin' edge can be sharp

14 November 2007

One of the things we showed off at DevConnections last week was the latest pre-alpha iteration of our WPF Grid.

The devs responsible for our snappy ASPxGridView, Andrew and Mike, have been heads down in WPF and XAML internals over the past several months, understanding the platform and seeing how to bend it their will. And, of course, the ASPxGridView occupied some of their time too: witness the changes to appear in DXperience v2007 vol3.

You may think this is bizarre: an ASP.NET grid and a WPF grid are indubitably very different beasts. Surely we have devs just sitting around playing CounterStrike, eager and ready to take on a new project like WPF? Well, no, actually. Work never seems to stop in the DevExpress labs. Besides which, there are a lot of similarities between writing a control like the grid for ASP.NET and WPF.

First and foremost, it's all about the visuals. ASP.NET pretty much forces you to that point (the browser is a fairly primitive execution engine and is far better at showing stuff), and it's the whole premise of WPF. Second, it's all about styling: gone are the days of having a control with a bazillion different properties and methods for altering the appearance. Today it's CSS and styling using XAML. Third, it's about reusing the data access components we've already spent a great deal of time implementing, testing, stressing, making rock-solid.

All in all, Mike and Andrew were the best people we have to do the job. They know grids inside out (Mike wrote the original XtraGrid, the very first third-party .NET control ever released, and the first one with source code too). And what a great job they've done so far.

Let's see. At present the grid displays record data in a tabular form, rows and columns, with the rows corresponding to records and the columns to the fields of those records. Bog standard stuff. There is already support for unbound fields (calculated fields, if you like). We have sorting and grouping to many levels. It can calculate overall footer-type totals as well as group summary totals. Of course, the grid has the large dataset support we've been talking at length about in our marketing with regard to our ASPxGridView and XtraGrid. Let me tell you, this grid is fast, no matter whether you are sorting or grouping or displaying data from a dataset with many tens of thousands of records. And frugal with memory at the same time. (I seem to recall something in Computer Science that says you can have speed or small memory consumption, but not both. We seem to have broken that rule.)

And we've spent a great deal of time thinking about and designing for the ability to easily style everything in sight (just look at those rounded corners on the first row of the detail grid as an example). In doing so, we ran into some limitations of the WPF Framework. For example, the ListView class would seem to be the ideal class to use for something like the grid, since it displays items in a list. Just make a template for a row to show the fields and Bob's your uncle, as we say in England. Except it was designed for a small number of items, not for thousands. (We used it as the basis of our jog wheel selector in our demo, for example.) When you load thousands of items into the ListView, you have to create not only the data structures to hold the data, but also the visual elements to hold it all. Massive huge whopping memory usage, that's what happens, and that's before you start worrying about how to style it all. And it just didn't have the number and breadth of styling entry points we wanted to expose.

Hence one reason we're not at the forefront of releases for WPF controls is that we won't compromise on performance and features just to be first. We also wanted to be quite sure that we designed our grid for the WPF environment and that means giving designers the ability to style the look of the grid, whether though tweaking XAML or using a designer. Writing anything in WPF is a delicate balance between writing traditional imperative code in C# or VB or C++ and writing declarative code in XAML. The end result was that we decided to write our own container element for the grid and not reuse something that's manifestly not up to the job. Er, yes, that would be extra work, but well worth it we believe, even though it takes longer to get the control out.

So, where do we stand? Well, if you just wanted a WPF grid to display data, we could just about release tomorrow, albeit without documentation and a designer for VS2008 and a bunch of other things. Of course no one really wants just that, they also need the ability to edit the data in the grid. We've already shown that we can style individual cells (see the "check box cells" in the image), and an editor is "merely" just another style applied to a cell. If only it were that easy, but there are a lot of issues still to take care of. Nevertheless, progress on the remaining work (designers, editing, demos, documentation, etc) for the WPF grid is looking good.

We are also looking forward to getting our hands on the RTM of Visual Studio 2008 so that we can discover, along with everyone else on the planet, exactly what the WPF designers and interfaces (aka Cider) are like and how easy they are to use. I know there's already a designer application out there, but please don't ask me about Microsoft Blend, I tend to froth a bit at the mouth.

All in all, the WPF grid won't be released this year. Early next is our current in-house prediction. As usual though we do not give out actual release dates so you'll have to be satisfied with that deliberately hedged and ambiguous timetable. I dare say we'll be looking for some beta test sites before release, so if you are a DXperience Enterprise customer and are looking at WPF, drop me a line.

A word of caution though. It's going to take time for us to create the other controls we have for WinForms on the WPF platform, at least those that make sense. Do not expect us to magically declare a whole slew of WPF controls over the next six months (say). It isn't going to happen. Indeed, we're very much of the opinion that WinForms is not going to suddenly disappear overnight in favor of WPF. It's going to take time for the community as a whole to understand what can be done with WPF, what even makes sense to be done with WPF, how VS2008 is going to shake out, how Blend is going to progress, and so on. Be at the bleeding edge if you want, but we have to balance progress in this direction with all the other directions we're actively pushing forward in.

9 comment(s)
Nate Laff

Very informative! You nailed it on the head... no one, well, not no one, some people, really know what WPF can do, and what makes sense to do. Esp with the cross app winform/wpf form support in VS2008.

But as a customer, I respect and support your decision to take your time and not just rush something out to be first. Good call!

14 November, 2007
Ralph Trickey

I'll second that. I've read enough about WPF to know that it's 1,000 times more flexible and more comlicated than the previous versions. Just figuring out the proper interfaces and idioms that people are going to use is going to take some time.

14 November, 2007
Julien Ferraro

Well Julian, great post, and very informative, as usual.

Those who were at DevConnection had a chance to see the grid live, not just a pic. What about releasing this demo just to let us see the grid in action. I don't want source code. Just an dotfuscated executable.

I just want to play with that grid !!!

Nothing more to do than just put the exe file in the client center for DXperience Enterprise customer

Is this possible ? Please, tell me yes

14 November, 2007
Rollie Claro

Julian,

   you're the man!

  oh please!

  I beg you!

  spare us a piece of alm (WPF demo in the client center i mean)?

15 November, 2007
Kai

Looks damn great Julian. Guess we'll just have to wait until you're ready to release WPF stuff

15 November, 2007
Gary Gibbons

Julian, I always enjoy your blogs - you have a talent for articulating quite succinctly and with clearity in your writing.

Ever think about literature as a career?

Oh ya, I can't deal with a whole slew of WPF yet, so take your time - we'll all get there!

Gary

16 November, 2007
Urs Notter

Thanks for the greate WPF insights. Would it be possible to get a hold of your WPF executable demo(we hold enterprise licenses), so it could be shown to management and business. I've dropped a mail describing our needs to your support with that request today.

R.

3 March, 2008
Eyal Knaan

How I can to download the demo of dxgrid for WPF

10 June, 2008
Julian Bucknall (DevExpress)

Eyal

You can't. It's not in beta yet. There'll be an announcement and a blog post when it is ready.

Cheers, Julian

10 June, 2008

Please login or register to post comments.