title: Binding selected item in listbox with datatemplate
body: <p>I have simple listbox here: <a href="https://www.dropbox.com/s/d4tq86njso54e4h/listbox.PNG" rel="nofollow">link to image</a> where I have binded data. Now when I tap on one item(one row) listbox item/row is selected/violet color but in fact this item is not real selected only row change color but when I click on image or text then row where I click in not selected/violin but item in code is selected. I'm not sure if You understand what I'm saying. In short if I click on blank space row then row is visual selected but sender like listbox item not get data, if I click on text or image then sender get data but its not visual selected. How I can do it when I click anywhere row is selected/violet and item-sender get data?</p>
  
  <p>And my second question is why my rectangle used like line has max width like text I want strech this rectangle at full width of listbox is this possible? </p>
  
  <p>XAML:</p>
  
  <pre><code>&lt;ListBox x:Name="lbMessagesUsersList" Foreground="Black" ItemsSource="{Binding MyDatasMessagesUserList }"&gt;
                  &lt;ListBox.ItemTemplate&gt;
                      &lt;DataTemplate&gt;
                          &lt;ListBoxItem Tapped="userTapped"  Tag="{Binding}" &gt;
                            &lt;StackPanel&gt;
                                  &lt;Grid&gt;
                                      &lt;Grid.ColumnDefinitions&gt;
                                          &lt;ColumnDefinition Width="50"/&gt;
                                          &lt;ColumnDefinition Width="*"/&gt;
                                      &lt;/Grid.ColumnDefinitions&gt;
                                      &lt;Image Grid.Column="0" Source="{Binding MessengeHisPhoto}" HorizontalAlignment="Left" Width="40" Height="40" Margin="5,-18,0,-18" Stretch="Fill" &gt;&lt;/Image&gt;
                                      &lt;TextBlock x:Name="tbMessengerName"  Text="{Binding MessengeFullName}" HorizontalAlignment="Left"
                                        Grid.Column="1" Margin="25,0,0,0"/&gt;
                                  &lt;/Grid&gt;
                                  &lt;Rectangle Height="1" Margin="0,0,0,-38" HorizontalAlignment="Stretch"&gt;
                                      &lt;Rectangle.Fill&gt;
                                          &lt;SolidColorBrush Color="Black"/&gt;
                                      &lt;/Rectangle.Fill&gt;
                                  &lt;/Rectangle&gt;
                              &lt;/StackPanel&gt;
                          &lt;/ListBoxItem&gt;
                      &lt;/DataTemplate&gt;
                  &lt;/ListBox.ItemTemplate&gt;
              &lt;/ListBox&gt;
  </code></pre>
  
  <p>CS:</p>
  
  <pre><code>    private void userTapped(object sender, TappedRoutedEventArgs e)
      {
          var button = sender as ListBoxItem;
          if (button != null)
          {
              var subject = MyDatasMessagesUserList.FirstOrDefault(sub =&gt; sub == button.Tag);
              if (subject != null)
              {
                  IdOfChoosenUser = subject.MessengeIdUser;
              }
          }...
  </code></pre>
  
  <p>I also try remove ListbOxItem and set binding tag to stackPanel but this dont work too.{</p>