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;
}

猜你喜欢

转载自www.cnblogs.com/JqkAman/p/11246488.html