Access to DataGrid inside other DataGrid.RowDetailsTemplate
<p>i have two <code>DataGrid</code> <code>Concour</code> and <code>Epruve</code> i want to make <code>Epreuve</code> Shows when a row from <code>Concour</code> is selected .. my problem is how to get access to the <code>DataGrid</code> <code>Epreuve</code> To Fill it from <code>MySQL</code>.</p>

<p>This is what i tried </p>

<p><strong>XAML</strong></p>

<pre><code>&lt;DataGrid x:Name="Concours" IsReadOnly="True" AutoGenerateColumns="True" CanUserReorderColumns="True" CanUserResizeColumns="True" CanUserResizeRows="False" CanUserSortColumns="True" SelectionChanged="Concour_SelectionChanged" HorizontalAlignment="Left" Margin="288,48,0,0" VerticalAlignment="Top" Height="345" Width="652"&gt;
        &lt;DataGrid.RowDetailsTemplate&gt;
            &lt;DataTemplate&gt;
                &lt;DataGrid x:Name="Epreuve" IsReadOnly="False" CanUserAddRows="True" CanUserDeleteRows="True" CanUserReorderColumns="True" CanUserResizeColumns="True" CanUserSortColumns="True" CanUserResizeRows="False" RowDetailsVisibilityMode="VisibleWhenSelected"&gt;
                    &lt;DataGrid.Columns&gt;
                        &lt;DataGridTextColumn Header="Code" Binding="{Binding Code}"/&gt;
                        &lt;DataGridTextColumn Header="Désignation" Binding="{Binding Designation}"/&gt;
                        &lt;DataGridTextColumn Header="Coefficient" Binding="{Binding Coef}"/&gt;
                        &lt;DataGridTextColumn Header="Date" Binding="{Binding Date}"/&gt;
                    &lt;/DataGrid.Columns&gt;
                &lt;/DataGrid&gt;
            &lt;/DataTemplate&gt;
        &lt;/DataGrid.RowDetailsTemplate&gt;
</code></pre>

<p><strong>CS</strong></p>

<pre><code>private void Concour_SelectionChanged (object sender, EventArgs e)
    {
        //Get the First Cell Value
        DataTable dt = new DataTable();
        dt = ((DataView)Concours.ItemsSource).ToTable();
        List&lt;String&gt; L = new List&lt;string&gt;();
        foreach (DataRow row in dt.Rows)
        {
            L.Add((String)row[0]);
        }
        int row_number = Concours.SelectedIndex;
        //Connect To DataBase (gestion_concour)
        MySqlConnectionStringBuilder builder = new MySqlConnectionStringBuilder();
        builder.Server = "127.0.0.1";
        builder.UserID = "root";
        builder.Password = "root";
        builder.Database = "gestion_concour";
        MySqlConnection connection = new MySqlConnection(builder.ToString());
        connection.Open();
        //Fill Epreuve 
        String q = "SELECT * FROM gestion_Concour.concour WHERE Code = @Code";
        MySqlCommand cmd = new MySqlCommand(q, connection);
        cmd.CommandText = q;
        cmd.Parameters.AddWithValue("@Code", L[row_number]);
        cmd.ExecuteNonQuery();
        MySqlDataAdapter DA = new MySqlDataAdapter(cmd);
        DataTable DT = new DataTable("Epreuve");
        DA.Fill(DT);
        Epreuve.ItemSource = DT.DefaultView;
        DA.Update(DT);
        connection.Close();
    }
</code></pre>

<p>and i got this ERROR</p>

<blockquote>
  <p>The name 'Epreuve' does not exist in the current context</p>
</blockquote>