#458 – Properties to Set When Using a Horizontal or Vertical GridSplitter
December 26, 2011 2 Comments
To get the desired behavior when using a GridSplitter element, you need to set HorizontalAlignment and VerticalAlignment properties as shown below.
For a vertical splitter:
- Put GridSplitter in its own column, setting column’s width to Auto
- Set Grid.RowSpan to span all rows of the Grid
- No need to set Grid.Row property (defaults to 0)
- Set Width of GridSplitter to be desired thickness
- Set HorizontalAlignment to Center
- Set VerticalAlignment to Stretch
For a horizontal splitter:
- Put GridSplitter in its own row, setting row’s height to Auto
- Set Grid.ColumnSpan to span all columns of the Grid
- No need to set Grid.Column property (defaults to 0)
- Set Height of GridSplitter to be desired thickness
- Set HorizontalAlignment to Stretch
- Set VerticalAlignment to Center
Pingback: Dew Drop – December 28, 2011 (#1,228) | Alvin Ashcraft's Morning Dew
Pingback: #459 – Using Two (or More) GridSplitter Elements in the Same Grid « 2,000 Things You Should Know About WPF