I hava a data model which looks like this:
public class Model
{
public string DisplayAs {get;set;} // TextBox, CheckBox, ComboBox
public string Value {get;set;}
public string DisplayName {get;set;} // Row1, Row2, ...
}
Now I want to display these models in a Datagrid which shall look like this:
How could I achieve this? Please provide some example code. I tried the whole day with different kind of DataTemplateSelectors but I just can't get it working
Your selector selects a template for the cells in the second column based on their
DisplayAs
value. You have to add the templates to yourDataGrid.Resources
. Then in the second column, you assign theCellTemplateSelector