How to get an instance attached to a DataGridTemplateColumn?

Sep 23, 2009 at 12:48 PM

Hi,

I’m using  a custom control (written in WPF) in DataGridTemplateColumn as below:

<Controls:DataGridTemplateColumn Header="Aggregator">

 <Controls:DataGridTemplateColumn.CellTemplate>

  <DataTemplate>

  <NamedPlugInControl:NamedPlugInEditor NamedPlugIn ="{Binding Path=Value, UpdateSourceTrigger=PropertyChanged}"></NamedPlugInControl:NamedPlugInEditor>

                 </DataTemplate>

  </Controls:DataGridTemplateColumn.CellTemplate>

</Controls:DataGridTemplateColumn>

I need an instance of NamedPlugInEditor (which is a custom control) to initialize it in code behind (because my custom control has some widgets which want set programmatically). Is there any way to do this?

This is way that I've tried:

DataGridTemplateColumn templateColumn = (DataGridTemplateColumn)aggregatorDataGrid.Columns[4];

But I wasn't able to access the content in templateColumn.