I have a ContentPane containing a simple Grid which I add rows to programmatically at run-time.
When I reduce the size of the ContentPane so that not all the rows are visible, no vertical scrollbar appears. How do I cause it so that a scrollbar does appear?
I have a attached a simple example of the problem I am having.
Many thanks,
Jason
Hello Jason,
I believe the Grid will measure its children elements infinite height if you do not set their height property explicitly and this is why it is happening. One thing that you can do is create a scrollviewer around the grid which will give you the Scrollbars.
<ScrollViewer>
<Grid Name="grid">
<Grid.ColumnDefinitions>
<ColumnDefinition />
</Grid.ColumnDefinitions>
</Grid>
</ScrollViewer>
</igDock:ContentPane>
Below is the sample code, which I tried to implement, but no scrollBar is appearing whenever text is out of viewable area. Kindly tell me where I'm wrong.
<igDock:SplitPane igDock:XamDockManager.InitialLocation="DockedLeft">
<igDock:ContentPane Header="Left" IsPinned="True" Background="Transparent">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
< Grid.Row="0" Margin="0 10" Width="250">
<RowDefinition Height="35" />
<RowDefinition Height="Auto" />
<Button Style="{StaticResource Button_Theme}" Grid.Row="0"/>
<ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Auto">
<DockPanel Grid.Row="0" Margin="1">
</DockPanel>
</igDock:SplitPane>
Thanks,
VJ
Hi Andrew,
This is my code and I am also facing issue regarding mouse scroll. Could you please help me out?
<igDock:XamDockManager x:Name="dockSite1" Background="Transparent"> <igDock:DocumentContentHost> <igDock:SplitPane> <igDock:TabGroupPane> <igDock:ContentPane Header="Global" x:Name="globalDocument" AllowClose="False" > <ScrollViewer> <view:GlobalSearchMaintenanceCataloguePanel x:Name="globalContentPanel"/> </ScrollViewer> </igDock:ContentPane> </igDock:TabGroupPane> </igDock:SplitPane> </igDock:DocumentContentHost> </igDock:XamDockManager>
David
Your RowDefinitions you have defined are set to Auto. That means the Grid will measure those elements with an Infinity for the height and then they will be arranged based on that. I suspect that you meant to use * instead so the grid uses the remainder of the available area instead of sizing the children based on the content.