This question is locked. New answers and comments are not allowed.
Hi!
I'm trying to build a grid that will show x amount of columns depending on how much information is available for the current items.
Basically it's yearly information and I should show "Name, 2011, 2012, 2013..." etc.
so depending on the source which can be updated at runtime,
so depending on how the user filters another grid, I might have values for 2 years, starting at 1999 and I should therefore show 3 columns - Name, 1999, 2000. If the user changes the filter, the source might contain information for 4 years, starting 2002 - Name, 2002, 2003, 2004, 2005
I manage to create the columns like I'm showing in the code above. But I don't manage to add rows. How is it possible to do so?
I'm trying to build a grid that will show x amount of columns depending on how much information is available for the current items.
Basically it's yearly information and I should show "Name, 2011, 2012, 2013..." etc.
so depending on the source which can be updated at runtime,
ExportGrid.Columns.Clear();
var column =
new
GridViewColumn();
column.Header =
"Name"
;
ExportGrid.Columns.Add(column);
for
(var i = 0; i < years; i++)
{
column =
new
GridViewColumn();
column.Header = (Year + i).ToString();
ExportGrid.Columns.Add(column);
}
UpdateExportGridInformation();
so depending on how the user filters another grid, I might have values for 2 years, starting at 1999 and I should therefore show 3 columns - Name, 1999, 2000. If the user changes the filter, the source might contain information for 4 years, starting 2002 - Name, 2002, 2003, 2004, 2005
I manage to create the columns like I'm showing in the code above. But I don't manage to add rows. How is it possible to do so?