Reputation: 4116
Please pardon me for this vague header, please feel free to edit it and make it more meaningful. I will try to explain my problem as much as I can here.
I have a collection that is bound to dataGrid. User can neither add nor remove any object from it they can only add data into it.
So lets say my collection is ...
Column1--Column2--Column3--Value
Only Value field is editable and rest are static and readonly. This list has like 10,000 elements in it and hence makes its really difficult for users to add and use data in this grid.
-- Requirement --
Requirement is to have Column1s values to be split in to tabs ( which we know are only 4 )
Have column2s values as Rows
Have Column3s values as Columns
And Column4s as editable cells ..
thereby making an fairly easy to use UI
---- Current half cooked solution --
So far I am planning to create a new object that would map to this new grid. So I will have a list of col1 that will be bound to tabs a list of col3 as for columns with all values of col4 in it and there will be a static first column with list of all values of col2.
-- Help --
I am here to ask if dataGrid is capable of getting manipulating in such a view somehow so that I don't have this dependency on new object ? can I do this more efficiently because its just visual representation that I want to change, which should not need creation of new type.
All suggestions and critics welcomed. apologies if anything is not as per stackOverflow's rules and regs..
happy to edit anything if needed.
Upvotes: 0
Views: 1969
Reputation: 54791
I'm not going to pretend I fully understand your scenario. Some columns as rows, other columns as columns etc. But I am still fairly sure DataGrid
does not do what you want.
can I do this more efficiently because its just visual representation that I want to change, which should not need creation of new type.
Remember the ViewModel is an abstraction of the view. If you have to do a lot of work to shoe-horn the viewmodel into a view, including complicated binding logic or yucky backing code then that's not a good abstraction of the view. So you should have a ViewModel that represents the data closely to how it is to be displayed.
Part of the problem sounds like you want dynamic columns. If so, see this answer for binding a grid dictionary https://stackoverflow.com/a/14172511/360211
Upvotes: 1