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.
Explicitly set the Height
of the grid-row that you want to have an initial size.
Right now row3 is on Auto
and resizes to content, as soon as you drag the GridSplitter that value is being replaced by the current height of the row.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With