我正在使用数据网格控件处理UWP技术中的数据绑定任务。但问题是ScrollViewer。我希望ScrollViewer在数据网格中添加任何新项目时自动向下滚动,最后一个索引数据网格列表应该是在底部显示新项目。
请在下面找到我分享的快照:
代码:
<controls:DataGrid x:Name="dgNewBill" RowBackgroundEvenBrush="Black" RowBackgroundOddBrush="Black" ItemsSource="{Binding objStockIssueItemList}" VerticalAlignment="Stretch" Height="478" SelectionMode="Single" TabNavigation="Local" HeaderBackground="Black" Background="Black" BorderThickness="1" BorderBrush="Gray" Grid.Row="2" Grid.ColumnSpan="12" Margin="0,0,0,0" Loading="dgNewBill_Loading" TabIndex="2" ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.VerticalScrollMode="Auto" KeyUp="dgNewBill_KeyUp" DoubleTapped="dgNewBill_DoubleTapped">
</controls:DataGrid>
答案 0 :(得分:1)
的Xaml:
df = data.frame(name = c("Mr. William John", "Miss. Wendla Maria", "Mrs. Sandra"),
surname = c(" Mellors", "Heininen", "Gonzalez"))
# Set default value for *title* column
df$title <- 'married man'
# If name starts with 'Miss', then it is not married woman
df$title <- ifelse(grepl('^Miss. ', df$name), 'not married woman', df$title)
# If name starts with 'Mrs', then it is married woman
df$title <- ifelse(grepl('^Mrs. ', df$name), 'married woman', df$title)
代码背后:
<ScrollViewer x:Name="ScrollViewer" Width="400" Height="400" Background="LightGray">
<StackPanel x:Name="StackPanel" SizeChanged="StackPanel_OnSizeChanged"/>
</ScrollViewer>
查找