Reputation: 7587
Do you know if this is possible and if so how to do it?
I have a set of data which will be created at runtime in my view model. Now I want to present these data to the user in a grid which automatically creates columns and rows depending on the number of data items in my data source. When the window is created it should not generate it all over again - just let it be static as I think that is easiest.
my data source is a class containing a filepath, file name and an image.
Is it possible?
Upvotes: 0
Views: 162
Reputation: 4659
Yes it is possible. You can use Microsoft DataGrid. It has a lot of feature that can be helpful (automatic columns generation, virtualization, columns sorting and reordering...)
Alternatively, you can use a simple ItemsControl and set its ItemsPanel as a Grid, and then implement a custom logic to generate Rows/Columns when ItemsSource changes.
Upvotes: 1