title: accessing elements inside a data template in xaml
body: <p>i have a data template which have 2 text blocks and 1 button i need to access the button id to fetch specific data for every data template but the problem is the the button is not accessible from the c# code </p>
  
  <p>here is my XAML code   for the data template</p>
  
  <pre><code>          &lt;DataTemplate x:Key="CityItemTemplate"&gt;
  
                    &lt;Border BorderBrush="Black" BorderThickness="4" CornerRadius="8" Background="#FF003847" Width="320"&gt;
  
                  &lt;StackPanel Margin="4"&gt;
                      &lt;TextBlock x:Name="NameBlock" TextWrapping="NoWrap" Text="{Binding Content}" FontSize="38" VerticalAlignment="Center" Margin="0,0,4,0"  Grid.Column="1" TextTrimming="WordEllipsis"/&gt;
                      &lt;TextBlock x:Name="DescriptionBlock" TextWrapping="Wrap" Text="{Binding Description}" FontSize="24" VerticalAlignment="Center" Margin="0,0,4,0" Grid.Column="1" TextTrimming="WordEllipsis" MaxHeight="168"/&gt;
                      &lt;Button  x:Uid="{Binding idb}" x:Name="b12" Content="download&amp;#xD;&amp;#xA;" HorizontalAlignment="Left" VerticalAlignment="Top" Width="166" Height="87" Click="b1_click"  /&gt;
                  &lt;/StackPanel&gt;
              &lt;/Border&gt;
          &lt;/DataTemplate&gt;
  </code></pre>
  
  <p>and i need to know which button was clicked also ?</p>