Posts

Showing posts from March, 2025

WinUI app crashing when you scroll? Here's how to fix it

Years ago, Microsoft introduced this bug in WinUI 2, which can cause WinUI 2 apps to crash then you scroll to the bottom of a scrollable area in a ScrollViewer. You may have noticed this bug in built-in Microsoft apps such as the Microsoft Store, as they use WinUI. This bug was partially addressed in Windows 11, but can still occur.  Luckily, the bug only occurs with WinUI 2 and not plain UWP, so, to fix it, we can just use the UWP ScrollViewer style instead. To do this, just apply a blank style to all or just the offending ScrollViewers like so: <Style TargetType="ScrollViewer"/>  When you create your own style, it inherits from the UWP styles instead of the WinUI 2 styles, as explained here . You could apply it to an individual ScrollViewer like this: <ScrollViewer.Style> <Style TargetType="ScrollViewer"/> </ScrollViewer.Style> Or all of them in App.xaml like so: <Application.Resources> <controls:XamlControlsResources> ...