-
Notifications
You must be signed in to change notification settings - Fork 693
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
Fixing ScrollBar regression for Issue #4255 #4495
Conversation
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
This looks like a work-around not a fix. As someone who has spent a lot of time also trying to work-around the 'Layout Cycle Detected' bugs that crop up in apps I'm more interested in what the actual root cause of this is. Is there any plan to address what I assume are rounding errors in the layout math with WinUI 3? It shouldn't be possible to trigger a layout cycle exception by just adding a margin. Something deep is broken and it's going to keep popping up. |
@robloo, I agree with you completely. This is a workaround rather than a fix - my title/comments should have been clearer about this, like my branch name user/regisb/ScrollBarWorkaround5. We opted for a WinUI 2.6 workaround rather than shipping a QFE in every Windows OS version supported by WinUI 2.6. At this point we do not know the exact root cause and its location. It is likely in our layout engine, or maybe the ScrollBar code itself. It is a rounding error for sure, and again I agree that adding any Margin should not cause a layout cycle. We do have an open internal bug to track this issue for WinUI3+. Thanks. |
@RBrid Thanks for the details. It makes sense to skip the full fix for WinUI 2.x and instead focus resources on WinUI 3. I just wanted to be sure it wasn't going untracked. Glad to hear there is an internal bug. |
Fixes #4255
We recently added a 1px margin around the ScrollBar, in its default control template. That potentially caused a layout cycle on DPI levels other than 100%. The chosen solution is to remove that ScrollBar 1px margin and add instead a 1px padding where it's used the most: the ScrollViewer control.
So the ScrollViewer's control template is declared in WinUI 2.6 now and includes 2 new Grid elements around the ScrollBar controls, with a 1px Padding around them.
Only ScrollViewer_themeresources.xaml has the additional Grid elements (just like only ScrollBar_themeresources.xaml had the 1px margin).
The same trick is used in the new WinUI ScrollView control. Its default control template now includes 2 additional Grid elements surrounding its ScrollBar controls.
While in there, I also fixed a couple of things: