Monthly Archives: June 2016

WPF Grid Horizontal andVertical Seperator

This gets me every time… so I will blog this and will never have to Google around for it.  Hopefully, when I do so, this blog post appears top in the Google search results.

I need a WPF Grid Separator, basically a visual line that allows two parts of a page to be resized…..

I google for “WPF horizontal seperator” and the closest thing that came around was this blog post .  Close but not quite, so I though I could just translate the Width=”5″ to Heigh=”5″ and HorizontalAlignment=“Stretch” to VerticalAlignment=”Stretch”. Those translations do not quite work. So here it is in one place, the XAML for a WPF Horizontal and Vertical grid splitter.

At this point, my XAML looked like this:

<RowDefinition Height="*"/>
<RowDefinition Height="5"/>
<RowDefinition Height="*"/>

<ColumnDefinition Width="*"/>
<ColumnDefinition Width="5"/>
<ColumnDefinition Width="*"/>
<GridSplitter Grid.Column="1" Width="5" HorizontalAlignment="Stretch" />
<GridSplitter Grid.Row="1" Height="5" HorizontalAlignment="Stretch" />

Happy coding…