How to set initial height of a GridSplitter 'pane'?

I am using a GridSplitter in my WPF Window. Above the splitter is a TreeView, below is a DockPanel containing amongst other things a textbox. When I select an item in the TreeView, the DockPanel's contents are updated via data-binding.

Depending on the content of the TextBox, the lower pane of the Window expands and contracts in size. I want it to start at Height X, and stay at that Height unless the GridSplitter is dragged by the user.

I tried setting the Height of the lower DockPanel in the XAML, but this fixes the height of the DockPanel so that it doesn't resize when the GridSplitter is moved. Maybe the solution involves the Grid.Row Heights?

Here's the general structure of my page.

Window
  Grid
    row1 Height="*":    TreeView
    row2 Height="5":    GridSplitter
    row3 Height="auto": DockPanel  // gets taller and shorter depending on its content.
      ...
      TextBox

BTW: after I've dragged the GridSplitter, the resizing stops happening and the UI behaves how I want it to.

7
задан mackenir 14 April 2011 в 12:08
поделиться