How to get an instance attached to a DataGridTemplateColumn?

Sep 23, 2009 at 11:48 AM


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

<Controls:DataGridTemplateColumn Header="Aggregator">



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




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.