I'm trying to have a path in a datagrid. I wrote the following data template:

```
<DataGridTemplateColumn>
    <DataGridTemplateColumn.CellTemplate>
        <DataTemplate>
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="auto" />
                </Grid.ColumnDefinitions>
                <TextBlock Text="{Binding AlertProgram}" IsEnabled="False" Grid.Column="0" />
                <Button Content="..." Grid.Column="1" Click="Button_browse_alert_program" />
            </Grid>
        </DataTemplate>
    </DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>

```

(I wrote it straight into the `<DataGrid.columns>` elelment)

In the function `Button_browse_alert_program` I open a OpenFileDialog to get a file.

My problem is - I can't access the text box. I tried giving it a name using `x:Name="someName"` but the compiler complains that the name doesn't exist.

I have seen the following SO questions: [How to access datagrid template column textbox text WPF C#](https://stackoverflow.com/questions/16997951/how-to-access-datagrid-template-column-textbox-text-wpf-c-sharp), [How to access control in DataGridTemplateColumn to get value?](https://stackoverflow.com/questions/13226985/how-to-access-control-in-datagridtemplatecolumn-to-get-value)

Is there a way to do this without third party software, and without writing my own `FindChild` function?

(I'm quite new to WPF, so if you have other comments on my code - speak up)