WPF DataGrid default column types
Posted
by Trindaz
on Stack Overflow
See other posts from Stack Overflow
or by Trindaz
Published on 2010-04-15T04:29:46Z
Indexed on
2010/04/15
4:33 UTC
Read the original article
Hit count: 482
Hi,
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 = NULL 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
© Stack Overflow or respective owner