Note that there are some explanatory texts on larger screens.

plurals
  1. POScrollViewer to dynamically fetch new rows when reaching the bottom
    text
    copied!<p>I wish to create a scrollviewer which shows its vertical scrollbar regardless of whether it has items to scroll down or not. By doing this, I seek to dynamically fetch more data from a db as the user scrolls towards the bottom. The data is stored in a datagrid (dgGrid), and is wrapped by a scrollviewer (svMain) (see below). The data from the db is retrieved using a a method that triggers on the ScrollViewer.ScrollChanged event.</p> <pre><code>&lt;ScrollViewer Grid.Row="0" VerticalScrollBarVisibility="Visible" DockPanel.Dock="Top" Name="svMain" cal:Message.Attach="[Event ScrollChanged] = [Action ScrollMaster($eventArgs)]"&gt; &lt;StackPanel&gt; &lt;Grid Visibility="{Binding Path=IsFormView, Converter={StaticResource booleanToVisibilityConverter}}"&gt; &lt;Grid.ColumnDefinitions&gt; &lt;ColumnDefinition Width="200"/&gt; &lt;ColumnDefinition Width="200"/&gt; &lt;ColumnDefinition Width="200"/&gt; &lt;ColumnDefinition Width="200"/&gt; &lt;ColumnDefinition Width="200"/&gt; &lt;/Grid.ColumnDefinitions&gt; &lt;Grid.RowDefinitions&gt; &lt;RowDefinition /&gt; &lt;RowDefinition /&gt; &lt;/Grid.RowDefinitions&gt; &lt;StackPanel Grid.Row="0" Grid.Column="0" Orientation="Horizontal"&gt; &lt;CheckBox IsChecked="{Binding MasterDTO.ActiveFlag, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/&gt; &lt;Label Content="Active"/&gt; &lt;/StackPanel&gt; &lt;StackPanel Grid.Row="1" Grid.Column="0"&gt; &lt;con:MandatoryLabel Text="Country Id" /&gt; &lt;TextBox Text="{Binding MasterDTO.CountryId, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/&gt; &lt;/StackPanel&gt; &lt;StackPanel Grid.Row="1" Grid.Column="1"&gt; &lt;con:MandatoryLabel Text="Currency"/&gt; &lt;TextBox Text="{Binding MasterDTO.Currency, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/&gt; &lt;/StackPanel&gt; &lt;/Grid&gt; &lt;!-- Grid View --&gt; &lt;DockPanel Visibility="{Binding Path=IsGridView, Converter={StaticResource booleanToVisibilityConverter}}"&gt; &lt;DataGrid Name="dgGrid" Style="{StaticResource ReadOnlyDatagrid}" SelectedItem="{Binding Path=MasterDTO, Mode=TwoWay}" ItemsSource="{Binding MasterDTOs, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" cal:Message.Attach="[Event SelectionChanged] = [Action GridSelect]"&gt; &lt;DataGrid.Columns&gt; &lt;DataGridTemplateColumn Header="Active"&gt; &lt;DataGridTemplateColumn.CellTemplate&gt; &lt;DataTemplate&gt; &lt;controls:YesNoLabel Value="{Binding ActiveFlag}" /&gt; &lt;/DataTemplate&gt; &lt;/DataGridTemplateColumn.CellTemplate&gt; &lt;/DataGridTemplateColumn&gt; &lt;DataGridTextColumn Header="Country Id" Binding="{Binding CountryId}"/&gt; &lt;DataGridTextColumn Header="Currency" Binding="{Binding Currency}"/&gt; &lt;/DataGrid.Columns&gt; &lt;/DataGrid&gt; &lt;/DockPanel&gt; &lt;/StackPanel&gt; &lt;/ScrollViewer&gt; </code></pre> <p>The problem is that even though I set the VerticalScrollBarVisibility property of the scrollviewer to visible (and the vertical scrollbar is shown at all times), the scrollbar is disabled and there is no scroll thumb visible whenever the amount of data in the datagrid fits the height of the screen. If i resize the screen to a smaller size, the vertical scrollbar is enabled and I can move the thumb around. However, I want the scrollbar and its thumb to be enabled regardless of whether the the content of the viewport can accommodate its contents or not. Can anyone provide help on this?</p> <p>Thanks!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload