Como: Make Sure That a GridSplitter Is Visible
This example shows how to make sure a GridSplitter control is not hidden by the other controls in a Grid.
Exemplo
O Children de um Grid controle são processados na ordem em que eles são definidos na marcação ou código. GridSplittercontroles podem ser ocultados por outros controles, se você não defini-los como elementos no últimos a Children coleção ou se você fornecer outros controles de uma maior ZIndexProperty.
To prevent hidden GridSplitter controls, do one of the following.
- Make sure that GridSplitter controls are the last Children added to the Grid. The following example shows the GridSplitter as the last element in the Children collection of the Grid.
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Button Grid.Column="0"/>
<GridSplitter Grid.Column ="0" Background="Blue"/>
</Grid>
- Set the ZIndexProperty on the GridSplitter to be higher than a control that would otherwise hide it. The following example gives the GridSplitter control a higher ZIndexProperty than the Button control.
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<GridSplitter Grid.Column="0" Background="Blue"
Panel.ZIndex="1"/>
<Button Grid.Column="0"/>
</Grid>
- Set margins on the control that would otherwise hide the GridSplitter so that the GridSplitter is exposed. The following example sets margins on a control that would otherwise overlay and hide the GridSplitter.
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<GridSplitter Grid.Column ="0" Background="Blue"/>
<Button Grid.Column="0" Margin="0,0,5,0"/>
</Grid>