Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C#/WPF: Toolkit DataGrid - Transpose rows and columns

I've a

List<DetailObject> someList;

which looks like this:

    public class DetailObject
    {
        public string Titel { get; set; }
        public int Value1 { get; set; }
        public int Value2 { get; set; }
        public int Value3 { get; set; }
    }

Does anyone know how I can use (with DataGrid.AutoGenerateColumns="True") the value of 'string Titel' as RowHeader and other members as "Row" Content? Without any modifications, it'll show me "Titel" as ColumnHeader and the value of Titel as row, dito for "Value1" as ColumnHeader and the value(s) of Value1 as Rows etc.

Thanks for any help!

Cheers

EDIT: For better understanding, this is what I have

[Titel]       [Value1]       [Value2]       [Value3]
[Item1.Titel] [Item1.Value1] [Item1.Value2] [Item1.Value3] 
[Item2.Titel] [Item2.Value1] [Item2.Value2] [Item2.Value3] 
[Item3.Titel] [Item3.Value1] [Item3.Value2] [Item3.Value3] 

and this is what I'm looking for:

[Item1.Titel]  [Item2.Titel]  [Item3.Titel] 
[Item1.Value1] [Item2.Value1] [Item3.Value1]
[Item1.Value2] [Item2.Value2] [Item3.Value2]
[Item1.Value3] [Item2.Value3] [Item3.Value3]

EDIT2: I found also a nice approach here: http://codemaverick.blogspot.com/2008/02/transpose-datagrid-or-gridview-by.html

like image 277
Joseph jun. Melettukunnel Avatar asked Sep 24 '09 08:09

Joseph jun. Melettukunnel


1 Answers

This thread is a bit old but maybe someone is still interested ... I was also looking for way to transpose a WPF DataGrid and finally I found the following open source project on CodePlex:

Transposed WPF DataGrid

Hope this helps.

like image 71
marc wellman Avatar answered Oct 02 '22 05:10

marc wellman