Scrollbars on UserControls within LayoutPanels

1.4k views Asked by At

I'm having an issue with scrollbars and LayoutPanels. My LayoutPanel Code looks like this:

<dxdocking:LayoutPanel Width="450" >
                    <local:MyUserControl x:Name="UserControl"></local:MyUserControl >
                </dxdocking:LayoutPanel>

and then inside of MyUserControl it looks like this:

<Grid>
    <ScrollViewer>
          <StackPanel>
             ---Rest of Code----
          </Stackpanel>
    </ScrollViewer>
</Grid>

My goal is to use the scrollviewer inside of my UserControl rather than the layout panel, but instead it enables the LayoutPanel's Scrollviewer when the UserControl gets too big. It looks like this:

LayouPanel with 2 scrollbars

I would rather enable the inner scrollbar if necessary and never have the LayoutPanel's scrollbar visible. How can I do this?

Thanks!

1

There are 1 answers

0
DmitryG On

You can disable panel's embedded scrollbars via the LayoutPanel.VerticalScrollBarVisibility property:

<dxd:LayoutPanel Caption="Panel1" 
             HorizontalScrollBarVisibility="Disabled"
             VerticalScrollBarVisibility="Disabled">