tags:

views:

2639

answers:

8

I have seen a lot of discussions going on and people asking about DataGrid for WPF and complaining about Microsoft for not having one with their WPF framework till date. We know that WPF is a great UI technology and have the Concept of ItemsControl,DataTemplate, etc,etc to make great UX. Even WPF has got a more closely matching control- ListView, which can be easily templated to give better UX than a traditional Datagrid like display. And I would say a readymade DataGrid control will kill or hide a lot of creativity and it surely will decrease the innovations in User Experience field.

So what is your opinion about the need of DataGrid in WPF as a Framework component? If you feel it is necessary then is it just because the world is so used to the DatGrid way of data display for many years?

Some other threads having the discussion about DatGrid are here and here

Link to WPF ToolKit - Latest WPF DatGrid

+24  A: 

DataGrids are excellent for displaying large amounts of tabular data bound to a backing store.

But what happened in the WinForms world was that people often used them for everything that required a multi-element scrolling list. Souped-up third-party DataGrids soon became available that allowed columns and fields to contain buttons and ComboBoxes and icons, etc.

The DataGrid became a workhorse because there was a need for something it could be coaxed into behaving like. Similar happened to DataTables before generic collections came along--and when you're using lots of DataTables, presenting it in the UI with a DataGrid is the path of least resistance.

I think that when WPF came out, a lot of programmers like me were still thinking in this fashion, and sought out WPF ports of the DataGrid concept.

C. Lawrence Wenham
+5  A: 

Can't think of a better control to display tabular data, especially in business apps where you don't want to reinvent the wheel by templating/developing a (Headered)ItemsControl to make it behave like the good old DGV. I'm sure you saw this.

radu_c
+1  A: 

Yes it is! Among many other controls that ms failed to deliver. (Datepicker, NumericControl)

MS should first give us the tools to get the job done, that is the least i expect from a programming enviroment with the hype of wpf.

Entrodus
That's right!!! we do need DatePicker, NumericControl and actually ALL missing win-forms controls! and not only but if they want to attract ppl to WPF they should make easier life with many more built-in controls + builtin themes for each solution!!!
Shimmy
+1  A: 

After working with WPF for about 2 years now. I would say that a DataGrid is really just a glorified ListBox (since [almost] everything in WPF is styleless).

One could style a ListBox to take an Entity of some sort and show a "record" control for each entry. Depending on how flexible these are made, they could automatically adjust based on the entity passed.

Phobis
Datagrids offer a lot of facilities you can't do with a glorified listbox. Editing, sorting on any field, end-user grouping, and a hundred other features a good datagrid has.
Odi - Xceed
I agree... but the context of the question was really "What do I do? Microsoft doesn't have a DataGrid" I was giving the best answer at that time. Today, there is a DataGrid that does many wonderful things. I am not arguing that. This was posted when no DataGrid existed. My business was using the Infragistics DataGrid at the time.
Phobis
@Phobis, I don't agree, while ListBox only controls single-sided data, a DataGrid is made to control tabular data (columns+rows) which is amazing.
Shimmy
Shimmy, How do you expect that the columns work? Do you believe that you could add Grids into a list control and have their column widths bound to the same value? Then perhaps assign the context of controls within the grid to have the appropriate DataContext for the "column's" binding? I was only arguing that if someone needs a DataGrid bad enough (and one isn't available) that one could make one. I did something similar for a shared DataGrid column header. Anyway, we have a DataGrid now, so no worries :)
Phobis
+1  A: 

It is essential, but you can achieve nearly the same effect with a ListView that is using a GridView, can't you?

scmccart
Yeah exactly that is the origin of my question. I never thought of a big need for DataGrid in a great UI technology like WPF
Jobi Joy
There are a lot of things you don't get this way. Sorting on column content is only the most obvious and basic. You can implement sorting, sure, but why should you have to? In my shop we've added over 3000 lines of lines of code to the basic ListView/GridView to get a control suitable for us.
PeterAllenWebb
@scmccart, with a ListView you can't add new rows as easy as with the DataGrid, since there is no EditMode in the ListView.
Shimmy
+2  A: 

Yes DataGrids will never go away as essential business UI components. People love their spreadsheets and we want to share in that love!

Note that MS are shipping these extra controls - they have created the WPF Toolkit on CodePlex to provide a fast-turnaround, open-source style of deployment.

It already includes a DataGrid and Calendar.

Andy Dent
+2  A: 

Nobody is disputing that you can make a DataGrid control in WPF yourself. The same can probably be said about WinForms, although it would be more difficult. I've implemented some functionality with ListView - presenting tabular data is easy, you could even say it's well supported. However, the amount of code, manually written code, needed to make an editing ListView is enormous.

The business applications usually require editing of many tables, and you don't want to be creative, you want to be quick. That's why DataGrid is needed in my opinion.

Dragoljub
I'm disputing it. Making a good datagrid takes a hell of a long time. V1.0 of our datagrid (the Xceed one for WPF, back in Jan 2007) took 11000+ hours to make, and the upcoming Silverlight one will have taken over 17500 hours to make. Stability, features, good API, all take a long time... cheers
Odi - Xceed
A: 

If you want to see what a WPF datagrid can really do, whether with many columns or just one, I suggest you take a look at Xceed (I work for them).

XBAP (no-install) demo of Xceed DataGrid for WPF v4.0

XBAP (no-install) demo of a datagrid disguised as a listbox but with Asynchronous Data Virtualization.

Odi - Xceed