So when i have a Datagrid which i want to fill with data from my Database. I normally design a ViewModel with the Data i wanted to display. But how do i create an ViewModel for my Datagrid when i dont know before which data it will display in it ?
So when i allow the user of my application to specify the Columns from the database table which he wants to display in the Datagrid. How do i design the ViewModel for that case ?
So i hope its clear what i want to do.
thx in advance
Two solutions spring to mind.
Have the ViewModel hold all the columns and just have the user selected ones on the View. This is not ideal.
Use reflection on the View data to determine the columns for the ViewModel.