Hello,
I am writing my application in MVVM pattern.
I have a IEnumerable of ViewModels
each ViewModel has 4 properties- operator, field, value and RowID
I want the DataGrid to display the ViewModels so field is the column name. Value is the cell value under this field and operator is different column . So for all ViewModels that have same RowID , These ViewModels will be in same row in DataGrid. And so on. Also if Two ViewModels have same RowID but different Operator, than DataGrid will contain two operator columns.
How can i do it?
I tried to work with Dependency property but it's problematic since the DataGrid can be editable.
does anyone has an idea how to do it?
Hello Michael,
Thank you for your post. I have been looking into it, but it seems like am missing something about your scenario, so could you please send me screenshots of the result you want to achieve and a simple model of your data, so I can investigate your issue further for you.
Looking forward for your reply.
Hi,
This is the result of what i need.
For example i have a ViewModel that represents ULT. it has 2 children ViewModels (2 Datagrid rows) . Each such ViewModel has a child ViewModel that is a collection of child ViewModels (4 ViewModels) that represents each cell in the DataGrid.
but if i select Lot for example, it has 1 child ViewModel which contains ViewModel which has 1 child ViewModel (because Lot has only one field ).
So i don't know how many fields there might be.
Hello again,
Since you are not able to use two FieldLayouts in the XamDataGrid and switch between them, I can suggest you set you AutoGenerateFields property to True and set the DataSource of the XamDataGrid every time you choose different view model. This way the layout will be created dynamically based on your data.
Hope this helps you.