我想在中从textBlock获取文本
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Name="dateCreateTextBlock" Text="{Binding Path=DateCreate, Converter={StaticResource ResourceKey=TimeConverter }, ConverterParameter=DateCreate, StringFormat={}{0:dd/MM/yyyy HH:mm:ss}}" Background="{x:Null}" Margin="3,6"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>我搜索了像这样的东西
TextBlock tb = ((ContentPresenter)column.GetCellContent(row)).Content as TextBlock;但它不工作,我有tb = null;
发布于 2015-08-05 23:30:59
试试这个。
TextBlock tb = (TextBlock )GridName.Rows[((GridViewRow)((Control)sender).NamingContainer).RowIndex].FindControl("dateCreateTextBlock");https://stackoverflow.com/questions/31836579
复制相似问题