WPF DataGrid点击最后一行时,垂直滚动条下拉

为DataGrid 单元格样式追加如下

<DataGrid.Resources>
  <Style x:Key="ExDataGridCellStyle1" TargetType="DataGridCell" BasedOn="{StaticResource DataGridCellStyle1}">
    <EventSetter Event="RequestBringIntoView" Handler="DataGridCell_RequestBringIntoView"/>
  </Style>
</DataGrid.Resources>

事件实现

private void DataGridCell_RequestBringIntoView(object sender, RequestBringIntoViewEventArgs e)
{
  e.Handled = true;
}
posted @ 2019-07-25 19:41  苏秦与真相  阅读(330)  评论(0编辑  收藏  举报