Expandable columns in a datagrid

Posted by Jobe on Stack Overflow See other posts from Stack Overflow or by Jobe
Published on 2012-04-05T12:31:12Z Indexed on 2012/04/05 17:29 UTC
Read the original article Hit count: 178

Im working on a WPF-applications to present and correct large amounts of data. Im about to implement a datagrid containing data from 3 different sources that are populated from external services. To start with I will only populate the grid with data from one source, the master source. However, sometimes an automated validator will trigger a validation warning or error on one cell and the requirement states that the user should be able to view data from the additional 2 sources in columns next to the selected one.

Something like this:

Standard view:

| col1 src1 | col2 src1 | col3 src1 |
|           |           |           | 
|           |faulty     |           |
|           |           |           |

User want to show data from source 2 and 3 next to the column "col2 src1" like this:

| col1 src1 | col2 src1 | col2 src2 | col2 src3 | col3 src1 |
|           |           |           |           |           |
|           |corrected  |           |           |           |
|           |           |           |           |           |

and then be able to correct the faulty formatted cell with data from the other 2 soruces, and then collapse the columns again.

I am trying to use the mvvm pattern on this one so I have populated the DataGrid with a ListCollectionView so far. The list contains items with properties like this:

MyRowItem {string col1, string col2, string col3}

I will then have 2 additional collections with items of type like above but from 2 other sources.

I have no idea how to implement this functionality and could use some help on the logics. What approach should I head for?

© Stack Overflow or respective owner

Related posts about wpf

Related posts about c#-4.0