下にスクロールする項目があるかどうかにかかわらず、スクロールバーを作成して縦スクロールバーを表示したいとします。これを行うことで、ユーザーが下に向かってスクロールするときに、DBからより多くのデータを動的に取得しようとします。データはデータグリッド(dgGrid)に格納され、スクロールビューワ(svMain)でラップされます(下記参照)。 dbからのデータは、ScrollViewer.ScrollChangedイベントでトリガするaメソッドを使用して取得されます。ScrollViewerを使用すると、下に到達すると新しい行が動的に取得されます
<ScrollViewer Grid.Row="0" VerticalScrollBarVisibility="Visible" DockPanel.Dock="Top" Name="svMain" cal:Message.Attach="[Event ScrollChanged] = [Action ScrollMaster($eventArgs)]">
<StackPanel>
<Grid Visibility="{Binding Path=IsFormView, Converter={StaticResource booleanToVisibilityConverter}}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="200"/>
<ColumnDefinition Width="200"/>
<ColumnDefinition Width="200"/>
<ColumnDefinition Width="200"/>
<ColumnDefinition Width="200"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<StackPanel Grid.Row="0" Grid.Column="0" Orientation="Horizontal">
<CheckBox IsChecked="{Binding MasterDTO.ActiveFlag, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
<Label Content="Active"/>
</StackPanel>
<StackPanel Grid.Row="1" Grid.Column="0">
<con:MandatoryLabel Text="Country Id" />
<TextBox Text="{Binding MasterDTO.CountryId, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
</StackPanel>
<StackPanel Grid.Row="1" Grid.Column="1">
<con:MandatoryLabel Text="Currency"/>
<TextBox Text="{Binding MasterDTO.Currency, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
</StackPanel>
</Grid>
<!-- Grid View -->
<DockPanel Visibility="{Binding Path=IsGridView, Converter={StaticResource booleanToVisibilityConverter}}">
<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]">
<DataGrid.Columns>
<DataGridTemplateColumn Header="Active">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<controls:YesNoLabel Value="{Binding ActiveFlag}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn Header="Country Id" Binding="{Binding CountryId}"/>
<DataGridTextColumn Header="Currency" Binding="{Binding Currency}"/>
</DataGrid.Columns>
</DataGrid>
</DockPanel>
</StackPanel>
</ScrollViewer>
問題は、私は、可視のScrollViewerののVerticalScrollBarVisibilityプロパティを設定(および垂直スクロールバーを常時表示され)ても、スクロールバーが無効であることであり、可視ないスクロールサムが存在しないときはいつでも量のデータグリッド内のデータは画面の高さに適合します。画面のサイズを小さくすると、垂直スクロールバーが有効になり、親指を動かすことができます。しかし、私は、ビューポートの内容がその内容に対応できるかどうかにかかわらず、スクロールバーとその親指を有効にしたい。誰もこれについて助けを与えることができますか?
ありがとうございます!