I have bind the data to xamgrid columns and data dynamically. i am using templatecolumn and loading the datatemplate xaml at runtime.
sb.Append("<DataTemplate >"); //sb.Append("xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation' "); //sb.Append("xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'> "); sb.Append("<Grid>"); sb.Append("<TextBlock "); sb.Append("Text = '{Binding "); sb.Append(item.DataField + "}' ></TextBlock>"); sb.Append("</Grid>"); sb.Append("</DataTemplate>");
Creation of xamgrid columns at runtime :
var col = new TemplateColumn();
col.Key = item.DataField; col.HeaderText = item.HeaderText; col.ItemTemplate = (DataTemplate)XamlReader.Load(GetXamlForColumn(item)); grid.Columns.Add(col);
But i am not able to render the grid. Please help me if i am doing any thing wrong.
Hello,
Thank you for your post. I have been looking into and I created a sample project for you using your code, but with little modifications. The namespaces should be added in the DataTemplate opening tag, not after it. Please let me know if this helps you or you need further assistance on this matter.
Looking forward for your reply.