-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Layout rounding can cause DataGrid to hang #9944
Comments
Yeah, I can repro your issues and I think it is the WPF's bug. The loop in BringIndexIntoView will never return:
|
The computational logic here is too complicated for me. I have made no progress on this issue. @himgoyalmicro I want to remove the |
@lindexi Since I had an hour now, I've taken a look. The fix for the hang itself is kinda easy. Because of layout rounding, wpf/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Controls/DataGrid.cs Line 8522 in 58c3b2e
Also since The last question to investigate is whether there's a non-DPI adjusted value returned somewhere (or likely, adjusted twice), since the difference between being |
Hey @h3xds1nz, Thanks for taking a look at the problem! I'm glad it wasn't too hard to get around the issue. Looking forward to this landing in a release. |
Description
When
UseLayoutRounding=true
, theDataGrid
can hang in an endless loop trying to get a cell into view after resetting the data then settingDataGrid.CurrentCell
.It appears to happen particularly when the column expands beyond the width of the DataGrid, and only on certain screen scales.
Reproduction Steps
Expected behavior
Should not hang at any screen scale or layout rounding setting
Actual behavior
The application hangs and does not respond to input.
The offending method appears to be in
DataGridCellsPanel.BringIndexIntoView
, where it gets stuck in this loop:Stack Trace:
Regression?
Also happens with latest .NET Framework, not sure about earlier versions.
Known Workarounds
Turning off layout rounding for the DataGridRow appears to avoid the issue.
Impact
No response
Configuration
Running on Windows 11 23H2, .NET runtime 8.0.8 or 7.0.0
Reproducible on both x64 and ARM64 architectures.
Other information
No response
The text was updated successfully, but these errors were encountered: