This is a migrated thread and some comments may be shown as answers.

Creating Template Columns

2 Answers 40 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Patrick
Top achievements
Rank 1
Patrick asked on 10 Nov 2011, 03:37 PM
I've got some code that works with a normal Silverlight DataGrid which I'd like to convert to a telerik grid but am struggling to get it to work. I'm failing to build the correct equivalent namespaces for the telerik:blah components.
It's basically... 

sb.Append(@"<sdk:DataGridTemplateColumn");
sb.Append(@"  xmlns:my=""clr-namespace:Client.App.Views;assembly=Client.App""");
sb.Append(@"  Header="""" Width=""16"" CanUserReorder=""False"" CanUserResize=""False"" CanUserSort=""False"" IsReadOnly=""True"" >");
 
sb.Append(@"  <sdk:DataGridTemplateColumn.CellTemplate>");
sb.Append(@"    <DataTemplate>");
sb.Append(@"      <Image Source=*****blah blah blah goes here******* />");
sb.Append(@"    </DataTemplate>");
sb.Append(@"  </sdk:DataGridTemplateColumn.CellTemplate>");
 
sb.Append(@"</sdk:DataGridTemplateColumn>");

Please help.

2 Answers, 1 is accepted

Sort by
0
Patrick
Top achievements
Rank 1
answered on 10 Nov 2011, 03:53 PM
Worth adding, just to round it off...

StringBuilder sb = new StringBuilder();
... (all of the above) ...
grdBlah.Columns.Add(((DataGridTemplateColumn)XamlReader.Load(sb.ToString()));

I imagine the last line will change to something like...
grdBlah.Columns.Add((Telerik.Windows.Controls.GridViewColumn)XamlReader.Load(sb.ToString()));
...but I've tried and failed to convert the xaml to work with this.
0
Patrick
Top achievements
Rank 1
answered on 10 Nov 2011, 04:24 PM
Got it to work after finding this post.
Tags
GridView
Asked by
Patrick
Top achievements
Rank 1
Answers by
Patrick
Top achievements
Rank 1
Share this question
or