How do I bind a WPF DataGrid to a variable number of columns?

后端 未结 8 1523
逝去的感伤
逝去的感伤 2020-11-22 10:29

My WPF application generates sets of data which may have a different number of columns each time. Included in the output is a description of each column that will be used t

8条回答
  •  故里飘歌
    2020-11-22 11:11

    I have found a blog article by Deborah Kurata with a nice trick how to show variable number of columns in a DataGrid:

    Populating a DataGrid with Dynamic Columns in a Silverlight Application using MVVM

    Basically, she creates a DataGridTemplateColumn and puts ItemsControl inside that displays multiple columns.

提交回复
热议问题