How to Resize WPF Grid Rows with a GridSplitter?

The following code snippet adds a Grid splitter to a Grid that you can use to resize a Grid row.

<Grid Name="DynamicGrid" Width="466" Background="LightSteelBlue" ShowGridLines="True"

          Canvas.Top="119" Canvas.Left="8" Height="200">

      <Grid.ColumnDefinitions>

            <ColumnDefinition />

            <ColumnDefinition />

            <ColumnDefinition />

        </Grid.ColumnDefinitions>

        <Grid.RowDefinitions>

            <RowDefinition Height="50*" />

                <RowDefinition Height="Auto" />

                <RowDefinition Height="50*" />

            </Grid.RowDefinitions>

 

            <GridSplitter

                ResizeDirection="Rows"

                Grid.Column="0"

                Grid.ColumnSpan="10"

                Grid.Row="1"

                Width="Auto"

                Height="3"

                HorizontalAlignment="Stretch"

                VerticalAlignment="Stretch"

                Margin="0"

                Background="Green"/>

</Grid>

X

Build smarter apps with Machine Learning, Bots, Cognitive Services - Start free.

Start Learning Now