WPF row height binding stops working after user uses GridSplitter

binding, c#, grid, height, wpf

Solution

If you are binding to anything besides a GridLength, the binding will break. You can either bind to a GridLength property like this...

   private double documentsHeight = 100;

   public GridLength DocumentsHeight
    {
        get { return this.GridLength(this.documentsHeight); }
        set { this.documentsHeight = value.Value; }
    }

Also you'll need to set Mode=TwoWay on your binding.

Problem

I have a grid with four rows: ``` <Grid.RowDefinitions> <RowDefinition Height="Auto"/> <RowDefinition Height="{Binding DocumentsHeight}"/> <RowDefinition Height="Auto"/> - GRIDSPLITTER <RowDefinition Height="{Binding ApprovedDocumentsHeight}" /> </Grid.RowDefinitions> ``` The dynamic resizing of rows works fine, heights are binded to strings with values like "5*". But when the user uses the GridSplitter, the binding stops working, getters are not called after next notify when I want to change the size of rows. Does anybody know where is the problem? Thanks for help.

Original source