Ugrás a tartalomhoz

.NET Programming Technologies

Gergely Kovásznai, Csaba Biró

Eszterházy Károly College

GridSplitter

GridSplitter

Using GridSlitter control is possible during the program running to resize the rows and columns of the grid. It has to be placed between the rows and columns which we would like to resize. The ResizeDirection property can be used when we want to resize the rows or columns, the function of the ResizeBehaviour is to set the exact operation.

ResizeBehavior property:

  1. BasedOnAlignment

  2. CurrentAndNext

  3. PreviousAndCurrent

  4. PreviousAndNext

Example IV.7 Grid és GridSlitter

IV.8. Grid and GridSplitter

<Window x:Class="grid.MainWindow"

        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

        Title="Grid" Height="300" Width="500">

    <Grid>

        <Grid.RowDefinitions>

            <RowDefinition />

            <RowDefinition Height="150"/>

        </Grid.RowDefinitions>

        <Grid.ColumnDefinitions>

            <ColumnDefinition Width="2*"/>

            <ColumnDefinition Width="auto"/>

            <ColumnDefinition Width="*"/>

            <ColumnDefinition Width="*"/>

        </Grid.ColumnDefinitions>

        <Button Grid.RowSpan="2" Content="2 sor"/>

        <GridSplitter Grid.Row="0"

                      Grid.RowSpan="2"

                      Grid.Column="1"

                      Width="8"

                      Background="Beige"

                      ResizeBehavior="PreviousAndNext"

                      ResizeDirection="Columns" />

        <Button Grid.Column="2"

                Grid.ColumnSpan="2"

                Content="2 oszlop"/>

        <Button Grid.Row="1"

                Grid.Column="2"

                Content="1,2" />

        <Button Grid.Row="1"

                Grid.Column="3"

                Content="1,3" />

    </Grid>

</Window>