title: Browse Button in DataGridTemplateColumn of Datagrid in WPF
body: <p><img src="https://i.stack.imgur.com/VzIYb.jpg" alt="enter image description here">We have WPF application, In which we use DataGrid on one form.
  We have used multiple DataTemplateColumn in that DATAGRID.
  I need to take one button in one column, suppose 'BROWSE' button.
  Now when I click it in EDIT mode it open file dialog, when I select file, path of that file must get stored in that DATAGRID column.
  So how to achieve this, In EDIT mode BRowse button &amp; in Normal Mode Path of that file.</p>
  
  <pre><code>&lt;toolkit:DataGridTemplateColumn Header="Attachment Copy Of Invoice" Width="180" &gt;
                  &lt;toolkit:DataGridTemplateColumn.CellTemplate&gt;
                      &lt;DataTemplate&gt;
  
                          &lt;TextBlock x:Name="Attach"  Text="{Binding Path=Attachment,UpdateSourceTrigger=PropertyChanged}" /&gt;
  
                      &lt;/DataTemplate&gt;
                  &lt;/toolkit:DataGridTemplateColumn.CellTemplate&gt;
                  &lt;toolkit:DataGridTemplateColumn.CellEditingTemplate&gt;
                      &lt;DataTemplate&gt;
  
                          &lt;Button Name="Click" Click="Click_Click" &gt;&lt;/Button&gt;
                      &lt;/DataTemplate&gt;
                  &lt;/toolkit:DataGridTemplateColumn.CellEditingTemplate&gt;
              &lt;/toolkit:DataGridTemplateColumn&gt;
  </code></pre>
  
  <p>CODE:</p>
  
  <pre><code> private void Click_Click(object sender, RoutedEventArgs e)
      {
          Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
  
          // Set filter for file extension and default file extension
  
          dlg.DefaultExt = ".txt";
          dlg.Filter = "Text documents (.txt)|*.txt";
  
          // Display OpenFileDialog by calling ShowDialog method
          Nullable&lt;bool&gt; result = dlg.ShowDialog();
  
          // Get the selected file name and display in a TextBox
          if (result == true)
          {
  
              // Open document
  
              string filename = dlg.FileName;
  
  
          }
  
  
      }
  </code></pre>
  
  <p>I need to store filename i.e. path to same TextBlock.</p>