When the WPF DataGrid click on the last line, the vertical scroll bar drop-down

DataGrid cell pattern is added as follows

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

Event realization

private void DataGridCell_RequestBringIntoView(object sender, RequestBringIntoViewEventArgs e)
{
  e.Handled = true;
}

Guess you like

Origin www.cnblogs.com/JqkAman/p/11246488.html