I have a DataTemplate defined as follows:
I am accessing it at runtime using the code below:
else
{
template = (DataTemplate)FindResource("GridViewTextBlockDataTemplate");
var textblock = (TextBlock) template.LoadContent();
textblock.Text = "bye";
//textblock.SetBinding(TextBlock.TextProperty, new Binding("[" + current.Key + "]"));
}
var column = new GridViewColumn
{
Header = current.Key,
CellTemplate = template
};
gridView.Columns.Add(column);
}
And now I want to change the textblock property to something how can I do that? It always appears to be blank.