Default WPF DataGrid Column Types

I use a DataGrid to display the two possible types of DataRow in a DataTable. One type has a Parent = NULL column, and the other has a parent set in another DataRow in the same DataTable. The list of columns in the DataTable is always different, so an explicit description of each column is not possible.

I want to display the UserControl in each cell of the rows Parent = DataRow and the default Text / Check for the rows Parent = NULL. My first strategy is to try to set the default column type for all automatically generated columns as a DataGridTemplateColumn, regardless of the data type, so that I can use styles to use either my UserControl, or CheckBox or TextBox where necessary. How can i do this?

More important, however, is there a more effective strategy than this?

Cheers, dave

+3
source share

Source: https://habr.com/ru/post/1741205/


All Articles