title: Xaml Listbox stretching the whole usercontrol
body: <p>So I'm having a listbox showing some data in a usercontrol :</p>
  
  <pre><code>&lt;UserControl x:Class="FSBEM.UCs.SomeUC"
               VerticalAlignment="Stretch"
               HorizontalAlignment="Stretch"&gt;
  
       &lt;Grid Margin="7,0,9,0"&gt;
  
          &lt;Grid.RowDefinitions&gt;
              &lt;RowDefinition Height="40"/&gt;
              &lt;RowDefinition/&gt;
          &lt;/Grid.RowDefinitions&gt;
  
          &lt;ListBox x:Name="ListBox"
                   SelectedValuePath="Id"
                   ItemsSource="{Binding}"
                   Margin="0,5,5,5"&gt;
                   &lt;ListBox.ItemTemplate&gt;
                         &lt;DataTemplate&gt;
                             &lt;DockPanel&gt;
                                &lt;TextBlock DockPanel.Dock="Right"&gt;
                                   &lt;TextBlock.Text&gt;
                                      &lt;MultiBinding StringFormat="{}  {0} "&gt;
                                          &lt;Binding Path="Name" /&gt;
                                      &lt;/MultiBinding&gt;
                                   &lt;/TextBlock.Text&gt;
                                &lt;/TextBlock&gt;
                                &lt;Button x:Name="Btn_Delete"
                                        Padding="5,0,5,0"
                                        CommandParameter="{Binding}"&gt;
                                   &lt;Image Source="/Media/Icons/Delete_Icon.png"
                                          Width="10"
                                          Height="10"/&gt;
                                &lt;/Button&gt;
                              &lt;/DockPanel&gt;
                         &lt;/DataTemplate&gt;
                    &lt;/ListBox.ItemTemplate&gt;
          &lt;/ListBox&gt;
  
          &lt;TextBox Name="txtBox"
                   Height="22"
                   Margin="0,14,5,5"/&gt;
      &lt;/Grid&gt;
  
  &lt;/UserControl&gt;
  </code></pre>
  
  <p>and the problem is that the listbox does not stick to the main window border .. instead it stretches the whole usercontrol down beyond the main window .. I tried setting a MaxHeight but it's not a solution to me. I want to handle it to stick to the main window border and show a scrollbar when there is too mush data to display.</p>
  
  <p><strong>UPDATE</strong>
  this is the xaml code for the MainWindow :</p>
  
  <pre><code>&lt;Window x:Class="FSBEM.MainWindow"
          Height="471.997"
          Width="1186.374" 
          WindowStartupLocation="CenterScreen" 
          WindowState="Maximized"&gt;
  
  &lt;ScrollViewer FlowDirection="RightToLeft"
                HorizontalScrollBarVisibility="Auto"
                VerticalScrollBarVisibility="Auto"&gt;
     &lt;Grid x:Name="MainGrid"
           FlowDirection="RightToLeft"&gt;
          &lt;Menu x:Name="menu"
                HorizontalAlignment="Stretch"
                Height="23"
                VerticalAlignment="Top" /&gt;
  
          &lt;Grid Name="InnerGrid"
                Margin="0,23,0,20" /&gt;
  
     &lt;/Grid&gt;
  &lt;/ScrollViewer&gt;
  </code></pre>
  
  <p>and I'm showing the usercontrol in the "InnerGrid"</p>