Hi
hope somebody can help with this.
I have to extend the functionality of a custom control.
This control extends the dataGrid but adds certain extra customer required functionality to it.
I need to add a datatemplate of a combobox to this datagrid at runtime only (as it is based on the users selection of data to be displayed)
how do I programmatically add the template to the grid
I have been able to add a textcolumn in as follows but I can't add a datatemplate in the same manner.
var column = new DataGridTextColumn();
column.Header = item.Caption;
var binding = new Binding(string.Format("[{0}]", item.Index));
if (item.ValueDictionary == null)
{
binding.Converter = _stringFormatter;
binding.ConverterParameter = item.FormatString;
}
else
{
binding.Converter = _listToStringConverter;
binding.ConverterParameter = item.ValueDictionary;
}
binding.ConverterCulture = System.Threading.Thread.CurrentThread.CurrentCulture;
column.Binding = binding;
column.HeaderStyle = GetStyle(item.HeadingAlignment, true);
column.CellStyle = GetStyle(item.CellAlignment, false);
column.IsReadOnly = this.IsReadOnly || !item.IsEditable;
this.Columns.Add(column);
any help would be excellent Thanks
Col