Gridsplitter not showing

I am new to WPF. I declared Gridas follows:

<Grid.ColumnDefinitions>
    <ColumnDefinition Width="Auto"></ColumnDefinition>
    <ColumnDefinition Width="5"></ColumnDefinition>
    <ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid Grid.Column="0">
     <Grid.RowDefinitions>
         <RowDefinition Height="*"></RowDefinition>
         <RowDefinition Height="*"></RowDefinition>
         <RowDefinition Height="*"></RowDefinition>
     </Grid.RowDefinitions>
</Grid>

Basically, I want a 3rd column of width 5 to be GridSplitterand be modified for the left and right columns. So I have this code for the splitter:

<GridSplitter Grid.Column="1" Grid.RowSpan="3" ResizeDirection="Columns" Height="Auto"
              VerticalAlignment="Stretch" HorizontalAlignment="Center"
              Margin="0" Background="Black"/>

I do not see GridSplitterin the column. Did I install this correctly? Thank.

+5
source share
2 answers

You have a GridSplitter that centers the column in it, but it does not have a specific width. This way you efficiently center it with zero width. It also looks like you have two grids where you need it.

It sounds like you want something like this:

<Grid>
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="Auto"></ColumnDefinition>
        <ColumnDefinition Width="Auto"></ColumnDefinition>
        <ColumnDefinition Width="*"></ColumnDefinition>
    </Grid.ColumnDefinitions>
    <Grid.RowDefinitions>
        <RowDefinition Height="*"></RowDefinition>
        <RowDefinition Height="*"></RowDefinition>
        <RowDefinition Height="*"></RowDefinition>
    </Grid.RowDefinitions>

    <GridSplitter Grid.Column="1" Grid.RowSpan="3" ResizeDirection="Columns" Height="Auto"
         Width="5" VerticalAlignment="Stretch" Margin="0" Background="Black"/>

</Grid>

, .

+4

XAML

<Grid >
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="Auto"></ColumnDefinition>
        <ColumnDefinition Width="5"></ColumnDefinition>
        <ColumnDefinition Width="*"></ColumnDefinition>
    </Grid.ColumnDefinitions>


    <Grid.RowDefinitions>
        <RowDefinition Height="*"></RowDefinition>
        <RowDefinition Height="*"></RowDefinition>
        <RowDefinition Height="*"></RowDefinition>
    </Grid.RowDefinitions>

    <TextBox Grid.Column="0" MinWidth="100" />
    <GridSplitter Grid.Column="1" Grid.RowSpan="3" ResizeDirection="Columns" HorizontalAlignment="Stretch" />

    <TextBox Grid.Column="2" MinWidth="100" />
</Grid>

, 0- ?

                          

<GridSplitter Grid.Column="1" Grid.RowSpan="3" ResizeDirection="Columns" Height="Auto" VerticalAlignment="Stretch" HorizontalAlignment="Center"
                            Margin="0" Background="Black"/>

, , , , , 0.

, , XAML,

0

All Articles