ItemsControl with VirtualizingStackPanel scrolls when clicking the last visible CheckBox item
Description
Clicking the CheckBox of the last visible item in an ItemsControl does not immediately toggle its checked state. Instead, the content scrolls and brings additional items into view. This behavior occurs when the ItemsControl is hosted within a ScrollViewer and uses a VirtualizingStackPanel, making interaction with the bottom-most visible item inconsistent compared to other visible items.
Reproduction Steps
Please find the sample to replicate the issue:
Replication Procedure:
- Run the sample.
- Click the checkbox of the last row in the view port.
Video Reference
https://github.com/user-attachments/assets/c23c2258-5193-4238-9474-f693bfa64688
Expected behavior
A single click on last value in the viewport should directly toggle the checkbox state without causing any scrolling.
Actual behavior
Clicking the CheckBox of the last visible item in the viewport does not toggle the CheckBox state. Instead, the ScrollViewer automatically scrolls and brings additional items into view.
Regression?
No response
Known Workarounds
No response
Impact
No response
Configuration
.NET version -> .NET framework 4.8.1 OS version -> Windows 11 Enterprise & Version - 24H2
Other information
No response
Source: dotnet/wpf