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

207
5
Jump to solution
a month ago
OguzSariyildiz
Occasional Contributor

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

Reply
0 Kudos
2 Solutions

Accepted Solutions
KirkKuykendall1
Occasional Contributor II

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_GISInc
New Contributor II

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 II
Reply
0 Kudos
OguzSariyildiz
Occasional Contributor

Hi @KirkKuykendall1 

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

 

Reply
0 Kudos
KirkKuykendall1
Occasional Contributor II

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_GISInc
New Contributor II

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

OguzSariyildiz
Occasional Contributor

@KirkKuykendall1 and @StephenRhea_GISInc 

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;
        }