Wpf controls overlay?

2.3k Views Asked by At

I have Dockpanel on which there are two buttons (left and right sides) and a scrollviewer at the bottom. Is it possible to hide the left and right sides of this scrollviewer UNDER this buttons?

1

There are 1 best solutions below

1
On BEST ANSWER

You could use a Grid instead of a DockPanel, either use the alignments or create columns and adjust the ColumnSpan, example of the latter:

<Grid>
    <Grid.ColumnDefinitions>
         <ColumnDefinition Width="Auto"/>
         <ColumnDefinition />
         <ColumnDefinition Width="Auto"/>
    </Grid.ColumnDefinitions>
    <!-- Order matters, earlier controls are at the bottom unless you use Panel.ZIndex --> 
    <ScrollViewer Grid.Column="0" Grid.ColumnSpan="3"/> 
    <Button Grid.Column="0" Content="Left"/>
    <Button Grid.Column="2" Content="Right"/>
</Grid>

(DockPanel is quite a poor control which can easily be replaced with a Grid in about every case)