开发者

WPF DataGrid default column types

开发者 https://www.devze.com 2022-12-27 12:18 出处:网络
I\'m using a DataGrid to display 2 possible types of DataRow in a DataTable. One type has the column Parent = NULL and the other has Parent set to another DataRow in the same DataTable. The list of co

I'm using a DataGrid to display 2 possible types of DataRow in a DataTable. One type has the column Parent = NULL and the other has Parent set to another DataRow in the same DataTable. The list of column in the DataTable is always different, so explicitly describing each column is not possible.

I want to display a UserControl in every cell of the Parent = DataRow rows, and default Text / Check boxes for the Parent = NU开发者_运维百科LL rows. My first strategy is to try and set the default Column type for all automatically generated columns to be a DataGridTemplateColumn, regardless of datatype, so that I can use styles to then use either my UserControl or CheckBox or TextBox where required. How can I do this?

More importantly, though, is there a better strategy than this?

Cheers, Dave

0

精彩评论

暂无评论...
验证码 换一张
取 消