title: WPF converter on grid column and row length only works if gridsplitter is not used
body: <p>In WPF I have a boolean to length converter that I have binded to column and row definitions.</p>
  
  <p>This converter is used to read a binded boolean in order to determine whether the row/column should be hidden or shown.</p>
  
  <p>This is done so I can "maximize" a given portion of a grid or return it back to its original size.  This works so long as I don't use the gridsplitter to resize.  As soon as this happens it no longer sets the desired length.  I have a feeling once the gridsplitter is used it removes the binding on the column definition.  Is there a work around for this?</p>
  
  <p><strong>Converter</strong></p>
  
  <pre><code>[ValueConversion(typeof(bool), typeof(GridLength))]
  public class BoolToGridLengthConverter : IValueConverter
  {
      public int Length { get; set; }
  
      public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
      {
          return ((bool)value == true) ? new GridLength(Length == 0 ? 1 : Length, GridUnitType.Star) : new GridLength(0);
      }
  
      public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
      {    // Don't need any convert back
          return null;
      }
  }
  </code></pre>
  
  <p><strong>XAML</strong></p>
  
  <pre><code>&lt;Grid&gt;
      &lt;Grid.Resources&gt;
          &lt;helpers:BoolToGridLengthConverter x:Key="BoolToGridLengthConverter1" Length="1" /&gt;
          &lt;helpers:BoolToGridLengthConverter x:Key="BoolToGridLengthConverter2" Length="2" /&gt;
      &lt;/Grid.Resources&gt;
      &lt;Grid.ColumnDefinitions&gt;
          &lt;ColumnDefinition Width="{Binding ShowColumn1, Mode=TwoWay, Converter={StaticResource BoolToGridLengthConverter1}}" /&gt;
          &lt;ColumnDefinition Width="5" /&gt;
          &lt;ColumnDefinition Width="{Binding ShowColumn2, Mode=TwoWay, Converter={StaticResource BoolToGridLengthConverter1}}" /&gt;
          &lt;ColumnDefinition Width="5" /&gt;
          &lt;ColumnDefinition Width="{Binding ShowColumn3, Mode=TwoWay, Converter={StaticResource BoolToGridLengthConverter1}}" /&gt;
      &lt;/Grid.ColumnDefinitions&gt;
      &lt;Grid.RowDefinitions&gt;
          &lt;RowDefinition Height="{Binding ShowRow1, Mode=TwoWay, Converter={StaticResource BoolToGridLengthConverter1}}" /&gt;
          &lt;RowDefinition Height="5" /&gt;
          &lt;RowDefinition Height="{Binding ShowRow2, Mode=TwoWay, Converter={StaticResource BoolToGridLengthConverter2}}" /&gt;
      &lt;/Grid.RowDefinitions&gt;
      &lt;Grid Grid.Column="0" Grid.ColumnSpan="5" Grid.Row="0"&gt;&lt;/Grid&gt;
      &lt;GridSplitter Grid.Column="0" Grid.ColumnSpan="5" Grid.Row="1" ResizeDirection="Rows" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Height="5" /&gt;
      &lt;Grid Grid.Column="0" Grid.Row="2"&gt;&lt;/Grid&gt;
      &lt;GridSplitter Grid.Column="1" Grid.Row="2" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Width="5" /&gt;
      &lt;Grid Grid.Column="2" Grid.Row="2"&gt;&lt;/Grid&gt;
      &lt;GridSplitter Grid.Column="3" Grid.Row="2" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Width="5" /&gt;
      &lt;Grid Grid.Column="4" Grid.Row="2"&gt;&lt;/Grid&gt;
  &lt;/Grid&gt;
  </code></pre>
  
  <p>Edit: Restructured question to include more XAML</p>
  
  <p>Edit: Additional info, when I wish to expand a grid section I set all booleans to false and set the section I want to true.  For example, if I wish to maximize Grid.Column 2 and Grid.Row 2 I set all the booleans to false except ShowColumn2 and ShowRow2.  This works as intended and when the booleans are all set to true, to get the original view back it, it works as intended as well.  The issue is once I use a gridsplitter to resize a column it doesn't work as before.  When I maximize the same section as before it works fine, but when I attempt to resize back to the original size Grid.Column 2 and Grid.Row 2 takes up the whole bottom row.  The two columns besides them are minimized.</p>
  
  <p>This leads me to believe that when the gridsplitter is used the converter will no longer be able to set the column's value to true.</p>