Posts

Showing posts from May, 2017

WPF create a grid splitter

You will often find yourself needing to have two panels on a screen with a slider between them. WPF gives you a nice way to handle this with the GridSplitter control. You will need to create a column for the actual splitter and it will use the width you give it in the column definition. <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="*" /> <ColumnDefinition Width="5" /> <ColumnDefinition Width="*" /> </Grid.ColumnDefinitions> <TextBlock FontSize="55" HorizontalAlignment="Center" VerticalAlignment="Center" TextWrapping="Wrap">Left side</TextBlock> <GridSplitter Grid.Column="1" Width="5" HorizontalAlignment="Stretch" /> <TextBlock Grid.Column="2" FontSize="55" HorizontalAlignment="Center" VerticalAlignment="Center" Te