.net - Specifying and displaying columns of a DataGrid in WPF declaratively using a binding? -
Is there a way to declare datagrid columns using a binding? (And to determine the 'column properties' using this binding?) Ideally, I would have a list of objects (such as rows) for the database and one of their properties (or a list of items of a certain class) Or whatever) with a name and value. I would like that the DataGrid to automatically create these additional columns without some extra code. Is this also possible?
The array holding additional values can change over time, but the list will be identical for all objects.
It would be possible (and clean) to provide the datagrid with a separate list just to create the columns. But for this, I'll need column sort or something ...
The only thing I can do was create a sub-section of Datagrid ...
Any thoughts?
Edit: The issue is getting it without any code ...
The danger of being contentious ...
I think this is an example where the scene actually requires some code "boost", and 'no code-behind' guideline did On one side - as long as you keep your concerns separate, you will remember.
I, in the past, dynamically create datagrid controls by grabbing data related to view modal and writing a 'builddidgrid' method, for the same partial response, I believe in the code-behind That's it's fair, because the code was completely worried with the view supplement, and I did not explain the problems related to implementing business rules - it only puts together columns, and column B Nding made as appropriate.
But if it is more important to keep the code-behind clean, then I would recommend a basic idea about creating a user control and using the DP's original sub-section control.
Comments
Post a Comment