title: Find Controls placed inside ListView Wpf
body: <pre><code> &lt;ListView Height="Auto"   Name="lstIndent" SelectionMode="Single" Grid.ColumnSpan="5"  HorizontalAlignment="Stretch" VerticalAlignment="Top" Grid.Row="0"   &gt;
      &lt;ListView.View &gt;
         &lt;GridView x:Name="dgIndentDetails" &gt;
            &lt;GridViewColumn Width="Auto"   &gt;
               &lt;GridViewColumn.CellTemplate&gt;
                  &lt;DataTemplate&gt;
                     &lt;!--&lt;GroupBox Header="Department Issue Header" Grid.Row="5" Grid.ColumnSpan="5"  HorizontalAlignment="Stretch"  &gt;--&gt;
                        &lt;Grid&gt;
                           &lt;Grid.ColumnDefinitions&gt;
                              &lt;ColumnDefinition /&gt;
                              &lt;ColumnDefinition /&gt;
                              &lt;ColumnDefinition /&gt;
                              &lt;ColumnDefinition /&gt;
                           &lt;/Grid.ColumnDefinitions&gt;
                           &lt;Grid.RowDefinitions&gt;
                              &lt;RowDefinition  Height="Auto"  /&gt;
                              &lt;RowDefinition  Height="Auto"  /&gt;
                           &lt;/Grid.RowDefinitions&gt;
                           &lt;CheckBox Grid.Row="0" Grid.Column="0" IsChecked="{Binding Path=IsIndentIssue, UpdateSourceTrigger=PropertyChanged}" x:Name="chkbxIsChecked" HorizontalAlignment="Center"/&gt;
                           &lt;Label Grid.Column="1" Grid.Row="0" Content="{Binding ItemName}" x:Name="lbllstItemName" HorizontalAlignment="Center" &gt;&lt;/Label&gt;
                           &lt;Label Grid.Column="2"  Grid.Row="0" Content="{Binding Quantity}" x:Name="lbllstQty" HorizontalAlignment="Center" &gt;&lt;/Label&gt;
                           &lt;Label Grid.Column="3"  Grid.Row="0" Content="{Binding IssueQuantity}" x:Name="lbllstIssuedQty" HorizontalAlignment="Center" &gt;&lt;/Label&gt;
                           &lt;DataGrid  Height="Auto" Padding="10,10,10,10" Width="800" Grid.Row="1" Grid.ColumnSpan="5" Name="dgIssuedItemsBatchDetails"  AutoGenerateColumns="False"  HorizontalAlignment="Stretch" VerticalAlignment="Center"&gt;
                              &lt;DataGrid.Columns&gt;                                                                 
                                 &lt;DataGridTextColumn Binding="{Binding ItemName}"&gt;                                                                     
                                    &lt;DataGridTextColumn.Header&gt;                                                                         
                                       &lt;TextBlock Text="ItemName"/&gt;                                                                    
                                    &lt;/DataGridTextColumn.Header&gt;                                                                
                                 &lt;/DataGridTextColumn&gt;                                                                 
                                 &lt;DataGridTextColumn Binding="{Binding BatchNo}"&gt;
                                     &lt;DataGridTextColumn.Header&gt;
                                        &lt;TextBlock Text="BatchNo"/&gt;
                                     &lt;/DataGridTextColumn.Header&gt;       
                                 &lt;/DataGridTextColumn&gt;                                                                 
                                 &lt;DataGridTextColumn Binding="{Binding Quantity}"&gt;
                                    &lt;DataGridTextColumn.Header&gt;                                                                         
                                      &lt;TextBlock Text="Quantity"/&gt;                                                                    
                                    &lt;/DataGridTextColumn.Header&gt;
                                 &lt;/DataGridTextColumn&gt;
                             &lt;/DataGrid.Columns&gt;
                            &lt;/DataGrid&gt;
                         &lt;/Grid&gt;
                      &lt;!--&lt;/GroupBox&gt;--&gt;
                   &lt;/DataTemplate&gt;
                &lt;/GridViewColumn.CellTemplate&gt;
            &lt;/GridViewColumn&gt;
         &lt;/GridView&gt;
      &lt;/ListView.View&gt;
   &lt;/ListView&gt;
  </code></pre>
  
  <p>I need to find DataGrid <code>dgIssuedItemsBatchDetails</code> and then bind. That <code>DataGrid</code> is placed inside <code>GridView</code> and that <code>GridView</code> is placed inside ListView.</p>
  
  <pre><code>GridView grdvwIssueDetail = (GridView)lstIndent.FindName("dgIndentDetails");
  </code></pre>
  
  <p>By using this code I am able to find the <code>GridView</code>. My <code>DataGrid</code> is placed inside GridView DataTemplate. So suggest me how I can find my <code>DataGrid</code> from code behind.</p>