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.
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
Solved! Go to Solution.
Sorry, that sample is not very easy to experience.
Attached is a project that looks like this when I run it:
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>
Did you try doing what this sample does?
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>
@KirkKuykendall1 and @StephenRhea_NV5
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;
}