Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
355
Dynamically changing columns in XamDataGrid
posted

Hi,

I was wondering if it would be possible to change the columns displayed in a XamDataGrid based on a List of strings, being the names of the columns, using databinding only?

An example of the situation might be that I have a grid bound to a List of Person objects. The Person object has four properties, FirstName, LastName, Age, Height, Gender. Now I'd like somehow to bind this to a list of strings in my viewmodel, say "FirstName","LastName" and then have this display only the FirstName and LastName columns.

This would be easy enough to do in code as you could loop through the columns and set the ones you don't want to see to be collapsed or hidden, but  I was trying to avoid that if at all possible....??

Thanks,

Al