views:

45

answers:

1

I have implemented the listview to show an Observable collection coming in an MVVM desktop application. Now I'm wondering if I should have used the new datagrid instead. Can someone tell me what are the main advantages of using a datagrid control. I looked for some listview vs datagrid docs on the web but didn't find anything recent.

Thanks,

Richard

+1  A: 

I've abandoned the ListView for the DataGrid in .Net 4, since templating the columns is easier.

Layout is also more sensible, and I don't need to remember to set the HorizontalContentAlignment to Stretch to get the cell contents to cover the cell. Another nice bit of functionality is edit templates on the DataGrid, which relieves me of having to use a CellTemplateSelector to get a different control when editing the cell.

codekaizen
Thanks for your information. Are there any differences with events for data changes in columns, ease of sorting / filtering data or is it all much the same?
Richard
I'm not sure about that, since I use binding to a model in order to sort, filter and get data update notifications. But for that, ListView and DataGrid appear similar.
codekaizen
My current application has database > Entity Framework > Observable collection (in viewmodel) > listview. What's important for me is that I would like to have the data in the datagrid update when the database data changes. Not sure how simple that is to do but looking into it right now.
Richard