I'm trying to access a control which is inside the control template of a datagrid control in code behind.

myxaml.xaml :

```
<DataGrid >
.
.
.
<DataGridTemplateColumn x:Name="discountGridTextcolumn" >
    <DataGridTemplateColumn.CellTemplate>
    <DataTemplate>
        <StackPanel Orientation="Horizontal">
            <TextBox Name="discountText"/>
            <ComboBox x:Name="discountType"/>
        </StackPanel>
    </DataTemplate>
</DataGridTemplateColumn.CellTemplate>
.
.
.

```

mybehind.cs :

```
var comboBox = GetTemplateChild("discountType");

```

I get null reference.