title: Stretch panel with splitter
body: <p>I want to implement a basic WPF layout with three panels and two splitters (Horizontal and Vertical splitter).</p>
  
  <p>Two panels on the left and on the bottom has to be callapsable and one panel has to stretch accordingly.</p>
  
  <p>Here is a simple XAML:</p>
  
  <pre><code>        &lt;Grid&gt;
              &lt;Grid.ColumnDefinitions&gt;
                  &lt;ColumnDefinition Width="*"/&gt;
                  &lt;ColumnDefinition Width="5"/&gt;
                  &lt;ColumnDefinition Width="*"/&gt;
              &lt;/Grid.ColumnDefinitions&gt;
  
              &lt;StackPanel Background="Aqua" Grid.Column="0" Name="leftPanel" &gt;
                  &lt;TextBlock FontSize="35" Foreground="#58290A" TextWrapping="Wrap"&gt;Left Hand Side&lt;/TextBlock&gt;
              &lt;/StackPanel&gt;
  
              &lt;GridSplitter Grid.Column="1" HorizontalAlignment="Stretch"/&gt;
  
              &lt;Grid Grid.Column="2" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"&gt;
                  &lt;Grid.RowDefinitions&gt;
                      &lt;RowDefinition Height="*" /&gt;
                      &lt;RowDefinition Height="5" /&gt;
                      &lt;RowDefinition Height="*" /&gt;
                  &lt;/Grid.RowDefinitions&gt;
                  &lt;StackPanel HorizontalAlignment="Stretch" VerticalAlignment="Stretch"&gt;
                      &lt;Label Content="... Clien Area .. Has to Stretch vertically and horizontally" Margin="10"&gt;&lt;/Label&gt;
                      &lt;Button Click="LeftButton_Click" Margin="10"&gt;Close Left Panel&lt;/Button&gt;
                      &lt;Button Click="BottomButton_Click" Margin="10"&gt;Close Bottom Panel&lt;/Button&gt;
                  &lt;/StackPanel&gt;
                  &lt;GridSplitter Grid.Row="1" Background="Gray" HorizontalAlignment="Stretch"/&gt;
                  &lt;ListBox Grid.Row="2" Background="Violet" Name="bottomPanel"&gt;
                      &lt;ListBoxItem&gt;Hello&lt;/ListBoxItem&gt;
                      &lt;ListBoxItem&gt;World&lt;/ListBoxItem&gt;
                  &lt;/ListBox&gt;
              &lt;/Grid&gt;
          &lt;/Grid&gt;
  </code></pre>
  
  <p>and codebehind:</p>
  
  <pre><code>    private void LeftButton_Click(object sender, RoutedEventArgs e)
      {
          leftPanel.Visibility = (leftPanel.Visibility == System.Windows.Visibility.Visible)? System.Windows.Visibility.Collapsed : System.Windows.Visibility.Visible;
      }
  
      private void BottomButton_Click(object sender, RoutedEventArgs e)
      {
          bottomPanel.Visibility = (bottomPanel.Visibility == System.Windows.Visibility.Visible) ? System.Windows.Visibility.Collapsed : System.Windows.Visibility.Visible;
      }
  </code></pre>
  
  <p>This code doesn't work as expected :(. Any WPF experts around? to suggest a solution for having Client Area (stretched) and splitter at the same time?</p>
  
  <p>DockPanel will work perfectly, but I need splitter!</p>
  
  <p>Thanks.</p>