This is a migrated thread and some comments may be shown as answers.

Generate GridView from Dictionnary

3 Answers 118 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Thomas
Top achievements
Rank 1
Thomas asked on 11 Oct 2013, 09:41 AM
Hello everybody,

I need to generate a GridView at runtime from a Dictionary<DateTime,Dictionary<string,double>>.

I would like to display the different DateTime keys in GridView columns. The rows header of the grid would be fill with string keys of the second dictionary and the cells with values of this dictionary.
I precise that the keys of the Dictionary<string,double> are the same whatever the DateTime you choose.
I would like to know if it is possible to do such a thing only using xaml and binding or if it is necessary to build the grid in the xaml.cs file or if I need to use another method.

There is an example of the expected result :

 

Date1

Date2

Date3

Date4

Date m

String1

0

1

1,8

2,8

12,9

String2

0,5

16

15

5

2,9

String3

2

8

18

6

1,9

String4

4

7

12

1

1

String n

0

6

17

24

13


Thank you for your help.

Regards,
Thomas

3 Answers, 1 is accepted

Sort by
0
Shay
Top achievements
Rank 1
answered on 11 Oct 2013, 12:08 PM
Hi Thomas,

We are dynamically building Pivot tables at runtime. Unfortunately we are still doing this in the CodeBehind but we do it anyway.

We have all different types of cells and bindings depending on the selected entity being displayed and the users access rights.

We also have horizontal and vertical totalling of values where applicable.

As we are doing this in the CodeBehind I don't see why it could not be done from the ViewModel.

/Shay  
0
Thomas
Top achievements
Rank 1
answered on 11 Oct 2013, 02:40 PM
Thank you Shay for your answer. But I can't use Pivot Tables in my project.

I have another question :
In the "Windows GridViewColumn" there is a DisplayMemberBinding property, does it exist an equivalent property with "Telerik.Windows.Controls.GridViewColumn" ?

Thank you very much.

Regards,
Thomas
0
Thomas
Top achievements
Rank 1
answered on 11 Oct 2013, 03:25 PM
I've solved my issue ! Thank you for your help !
Tags
GridView
Asked by
Thomas
Top achievements
Rank 1
Answers by
Shay
Top achievements
Rank 1
Thomas
Top achievements
Rank 1
Share this question
or