4

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?

curiousity
  • 4,703
  • 8
  • 39
  • 59

1 Answers1

6

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)

H.B.
  • 166,899
  • 29
  • 327
  • 400