Hi,
Suppose I have a XAMGrid with two columns: Type and Value, is there a way to assign a different template for each value depending on the type?
Example:
https://ibb.co/enGVLk
Currently, the columns are being created programatically and are always 'TextColumn' like this:
foreach (var columnInfo in _currentViewmodel.BrowserSettings.ColumnsInfo) { var templateColumn = new TextColumn { Key = "NodeColumns[" + columnInfo.NodePropertyName + "].Value", MinimumWidth = columnInfo.Width, Width = new ColumnWidth(columnInfo.MaxWidth,false), HeaderText = columnInfo.Name, };
BrowserPaneGrid.BrowserPaneXamGrid.Columns.Add(templateColumn); }
Would need a way to do it by 'Cell' and not per 'Column' basis.
Thanks,
Erika
Hello Erika,
In order to show a different template on each row, I suggest you create a DataTemplate that uses DataTrigger to switch its content and assign it to TemplateColumn's ItemTemplate.
I have attached the demo sample.
Please let me know if I may be of further assistance.
Thank you,Mihoko Kamiishi
Thanks!
Thank you for your reply.
If you have any other questions, please do not hesitate to ask.