0

I'm watching at this page:

http://leeontech.wordpress.com/2010/02/01/summary-row-in-datagrid/

But they're using silverlight. I'm trying to create that user control to use it in a WPF C# application. I mean, not using Silverlight. But I can't find the namespaces: GroupHeader

I'm having a hard time with this. Thanks in advance.

oscar.fimbres
  • 1,145
  • 1
  • 13
  • 24

2 Answers2

1

I don't think you're not going to be able to get a silverlight control working in WPF.

Adding a footer row to the WPF datagrid is something a lot of people have complained about; it's ridiculous that it wasn't included out of the box.

See this thread from MSDN

Having been through this myself, your best bet will probably be to bite the bullet and use a third party control. It sucks, I know.

Adam Rackis
  • 82,527
  • 56
  • 270
  • 393
  • Ohh don't tell me that. Let's me see what can I do, I'm reading this post: http://stackoverflow.com/questions/678690/how-can-i-create-a-group-footer-in-a-wpf-listview-gridview – oscar.fimbres Aug 09 '11 at 19:11
  • I know, it sucks. Best of luck, just know that that link relates to a ListView, not a DataGrid. Even if you get your ListView looking right, there won't be column headers to click, etc. – Adam Rackis Aug 09 '11 at 19:36
1

Okay listen, you can totally do this, and in some scenarios I even recommend it.

  1. Using a CollectionViewSource you can easily group your data. In the HeaderTemplate you can even use an Expander (or make your own) and get the animation you might be wanting. Here's a link to a sample of this: http://jerrytech.blogspot.com/2010/06/wpf-data-presentation-step-by-step.html

  2. Using an ItemsControl, you can easily present your groups and details. In the ItemTemplate you can use styles make this look like a grid (if that is really what you want). You can also shift the style based on the type if your collection has more than one type of object in it (eat that datagrid!).

  3. You can wire up your column headers (which will really be custom objects, right?) and handle all the sorting and stuff like that. They will look just right! Not like datagrid WinForm column headers!

Here's what's hard (not impossible, but more coding).

  1. User-resizable columns.

  2. User-rearrangable columns.

  3. New record using bottom, empty row.

  4. Paste from Excel (doesn't work right in datagrid either).

  5. Select Row, highlight Column header.

That's it.

In lots of situations, this is really nice.

For the most part, I cannot stand the datagrid. Too restricting on UX.

Jerry Nixon
  • 31,313
  • 14
  • 117
  • 233