Having met a number of obstacles in getting Microsoft’s WPF DataGrid control to function as I required I decided it may be prudent to look at some of the other offerings. In the past I’ve been a big fan of the DevExpress suite of WinForms controls.
However, DevExpress have been a little slow to get on the WPF bandwagon. In fact even now (April 2009) their grid control is still only in Beta (expecting release in mid 2009). That’s a two full years behind the offerings from Xceed and Infragistics – what were they thinking!? Even if they did release now I’m really not sure I want to be working with a v1 DataGrid control when other vendors have more mature products available.
I remember taking a look at the Xceed WPF DataGrid when it first appeared – back in early 2007. At the time I found the demo app to be quite off-putting. All orange glow and black gloss with ridiculously rounded corners.
However, whilst searching the internet for clues on using Microsoft’s WPF DataGrid I had stumbled across a number of posts/articles related to the Xceed grid. In fact many more so than any other WPF grid control. So from this I figured it must have an active community, which got me to thinking that maybe it was time to see how far the Xceed offering has come in the last two years?
Comparison against Microsoft’s WPF DataGrid
So how does the Xceed DataGrid stack up against Microsoft’s? Here are some of the benefits that I’ve found so far:
- Binding to SelectedItem works just fine.
- ReadOnly properties support at Grid, Column and Row level.
- CheckBox column allows simple styling whilst preserving ReadOnly value.
- Automatically supports current selection and edit indicators in the row header.
- The grid theme matches the OS theme out of the box. This is how it should be. Sure the grid can be custom styled to suit but it only makes sense that by default the grid should match the look and feel of the standard themed controls.
- When auto-generating column headers it correctly uses any System.ComponentModel.DisplayName attributes that have been applied to the underlying class.
- There are lots of options at grid and column level that determine how a cell should enter edit mode. This is very useful for columns such as CheckBox columns where requiring a click to enter edit mode can be highly annoying (since the user would expect the click to toggle the checkbox).
In short – most of the stumbling blocks that I’ve hit getting the Microsoft WPF DataGrid to do something pretty trivial “just work” with the Xceed grid. That’s not to say there was no learning curve at all – I had to wrap my head around setting the ItemsSource to a DataGridCollectionView rather than direct to a ObservableCollection<T> to get anything to display for a start. But this was glaringly obvious as soon as I looked at any of the samples and “how to” guides. The supplied documentation is OK, but what impressed me most was the feedback provided on Xceeds community forums. Some really good answers provided by the Xceed team in an ultra timely fashion.
So what could be improved with Xceed’s DataGrid? Well, its a little early for me to provide a comprehensive list here – but off the cuff I’d make the following suggestions:
- An easier mechanism for custom sorting. Rather than having to specific custom IComparer implemenations often it is easier to refer to an unbound property that contains the raw data. Like Microsoft’s SortMemberPath property. Hmm… I wonder if you could use a generic SortComparer to provide the same functionality?
- Smaller assembly size. I know these days 2.08Mb shouldn’t be an issue but for my current contract it is. We have a ClickOnce application that is deployed to machines in remote country areas. Many of these machines are still using dial-up! Adding another another 2Mb to our current 4.5Mb total is a decision not to be made too lightly. [We’ve already been burned with a ridiculously bloated NHibernate assembly (1.6Mb)]
As much as I’ve had fun with the Microsoft DataGrid I’m now considering making the Xceed’s my DataGrid of choice – certainly for my own projects. Expect to see a few more posts on the Xceed DataGrid coming up soon.
Microsoft WPF DataGrid – www.codeplex.com/wpf
Xceed WPF DataGrid – www.xceed.com