How can I add a scroll bar to a DockPane in ArcGIS PRO SDK?

926
5
Jump to solution
01-27-2021 01:20 PM
Amadeus111
Occasional Contributor II

I generated a DockPane but some laptop users complained they are not able to see whole dockpane neither they can roll vertically to see the rest of the dockpane. There is a vertical scroll viewer shows up on catalog dockpane if content does not fit into it. I would like to utilize something like that.

 

OguzSariyildiz_0-1611782052881.png

 

OguzSariyildiz_1-1611782196953.png

On my dockpane I have list boxes mainly vs catalog pane has only tree view items but still there should be a way to do this

I tried a few things but I couldn't make it show up 

 <StackPanel x:Name="MainStackPanel" Background="WhiteSmoke" 
                    ScrollViewer.CanContentScroll="True" ScrollViewer.VerticalScrollBarVisibility="Visible"
                    ScrollViewer.HorizontalScrollBarVisibility="Visible"
                    >

 

I would appreciate any help - Thanks

0 Kudos
2 Solutions

Accepted Solutions
KirkKuykendall1
Occasional Contributor III

Sorry, that sample is not very easy to experience.

Attached is a project that looks like this when I run it:

KirkKuykendall1_0-1611791157822.png

 

View solution in original post

StephenRhea_AximGeo
New Contributor III

I think you're looking for the ScrollViewer XAML element.

<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
  <ScrollViewer.Content>
    <StackPanel x:Name="MainStackPanel" Background="WhiteSmoke">
    .
    .
    .
    </StackPanel>
  </ScrollViewer.Content>
</ScrollViewer>

 

View solution in original post

5 Replies
KirkKuykendall1
Occasional Contributor III
0 Kudos
Amadeus111
Occasional Contributor II

Hi @KirkKuykendall1 

I am not sure what that sample does. Do you mind elaborate?

 

0 Kudos
KirkKuykendall1
Occasional Contributor III

Sorry, that sample is not very easy to experience.

Attached is a project that looks like this when I run it:

KirkKuykendall1_0-1611791157822.png

 

StephenRhea_AximGeo
New Contributor III

I think you're looking for the ScrollViewer XAML element.

<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
  <ScrollViewer.Content>
    <StackPanel x:Name="MainStackPanel" Background="WhiteSmoke">
    .
    .
    .
    </StackPanel>
  </ScrollViewer.Content>
</ScrollViewer>

 

Amadeus111
Occasional Contributor II

@KirkKuykendall1 and @StephenRhea_AximGeo 

Thank you for your answers. Both ScrollViewer and ListBox functon the same in terms of scrolling but ListBox changed the design a little bit, so I decided to use ScrollViewer. However, neither of them was scrolling if the controls fit inside in it. Furthermore, when DockPane floating scroll bar was not auto adjusting

So, I created an event which adjust the height of ScrollViewer when UserControl's size changed. Now, it works fine and adapts the height when dockpane size changes.

Here is the code not proper MVVM but it works

 

 

private void KSDEUserControl_SizeChanged(object sender, SizeChangedEventArgs e)
        {
            StackPScrollViewer.Height = KSDEUserControl.ActualHeight;
        }