Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1310
How to create Dynamically GroupedColumns in XAMGrid
posted

Morning!

I have a little problem that need a solution which I have not found on the web. Let's go!

I have a group of data grouped by year from today's year until 2040.

Example: For the year 2012 I must show 5 columns (A,B,C,D,E), for the 2013 the same (A,B,C,D,E) columns... and so on until 2040.

The idea is to show a grid like this (or see attached image), where year's will be :

     2012                             2013                            2014

------------------            --------------------          ---------------------     and so on till 2040

A | B | C | D | E           A | B | C | D | E             A | B | C | D | E

 

My problem is that I need to create those X quantity of grouped columns when my data is received from the ViewModel. From my viewModel I receive each row to be displayed with the information of the quantity of columns that will be created (the years) having always the same ABCDE the columns for each year. Each row will contain the identical years and quantity of information to be displayed, so there will not be any column or year without information to be displayed.

Any idea of how can be this performed?

Actually I have hardcoded everything in XAML, but this needs to be a revision each 1st of january to delete the previous year and the same if one day we display a different end year...