C # WPF DataGrid Vertical Scrolling

I see the following behavior with WPF Datagrid. When there are more items, then vertical scrolling is available for the height of the viewport. When I click on the last line in a view, it scrolls automatically, where a line appears that was just below the last.

The first column of a datagrid is a checkbox. When the user clicks on this last line, I do not receive the event for clicks. The checkboxes in all other lines work fine.

I want to disable automatic scrolling, but can't figure out how to do this.

<Style x:Key="SingleClickEditing" TargetType="{x:Type toolkit:DataGridCell}"> <EventSetter Event="CheckBox.Checked" Handler="OnChecked"/> <EventSetter Event="CheckBox.Unchecked" Handler="OnChecked"/> </Style> 
+4
source share
2 answers

I found a solution here: WPF DataGrid: how to stop automatic scrolling when clicking on a cell?

I changed the style of the DataGrid

  <Style x:Key="SingleClickEditing" TargetType="{x:Type toolkit:DataGridCell}"> <EventSetter Event="CheckBox.Checked" Handler="OnChecked"/> <EventSetter Event="CheckBox.Unchecked" Handler="OnChecked"/> <EventSetter Event="Control.RequestBringIntoView" Handler="DataGrid_Documents_RequestBringIntoView" /> </Style> private void DataGrid_Documents_RequestBringIntoView(object sender, RequestBringIntoViewEventArgs e) { e.Handled = true; } 
+3
source

There is a property in Datagrid that you must set to determine whether vertical, horizontal, both, or None are visible (in relation to scrollbars).

0
source

All Articles