#458 – Properties to Set When Using a Horizontal or Vertical GridSplitter

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

About Sean
Software developer in the Twin Cities area, passionate about software development and sailing.

2 Responses to #458 – Properties to Set When Using a Horizontal or Vertical GridSplitter

  1. Pingback: Dew Drop – December 28, 2011 (#1,228) | Alvin Ashcraft's Morning Dew

  2. Pingback: #459 – Using Two (or More) GridSplitter Elements in the Same Grid « 2,000 Things You Should Know About WPF

Leave a comment