【发布时间】:2010-03-04 18:31:53
【问题描述】:
我有一个 DataTemplate 定义如下:
我在运行时使用下面的代码访问它:
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);
}
现在我想将 textblock 属性更改为我该怎么做?它总是显示为空白。
【问题讨论】:
标签: wpf datatemplate