Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
770
Find textblock defined in datatemplate
posted

Hi,

 I have defined DataTemplate in code behind as below

StringBuilder

 

CellTemp2 = new StringBuilder();

CellTemp2.Append(

"<DataTemplate ");

CellTemp2.Append(

"xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation' ");

CellTemp2.Append(

"xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'> ");

CellTemp2.Append(

"<Grid>");

CellTemp2.Append(

" <TextBlock x:Name=\"txtID\"  HorizontalAlignment=\"Left\" />");

CellTemp2.Append(

" </Grid>");

CellTemp2.Append(

" </DataTemplate>");

e.ColumnLayout.Columns.Add(

new TemplateColumn()

{

      HeaderText =

"",

        Key =

"ID",

      Width =

ColumnWidth.Auto,

      MinimumWidth = 40,

      MaximumWidth = 40,

     IsSortable =

false,

     IsResizable =

true,

     IsGroupable =

false,

    ItemTemplate = (

DataTemplate)XamlReader.Load(CellTemp2.ToString())

});

I want to display serial numbers in first column.

In Initialize_Row event how can i find textblock control and display row numbers for that.

Please give solution.

Thanks,

Nandu