Creating Template Columns

3 posts, 0 answers
  1. Patrick
    Patrick avatar
    11 posts
    Member since:
    Aug 2012

    Posted 10 Nov 2011 Link to this post

    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. Patrick
    Patrick avatar
    11 posts
    Member since:
    Aug 2012

    Posted 10 Nov 2011 Link to this post

    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.
  3. Patrick
    Patrick avatar
    11 posts
    Member since:
    Aug 2012

    Posted 10 Nov 2011 Link to this post

    Got it to work after finding this post.
Back to Top