Posts

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> ...

Quick fix for 'Unrecognized configuration section system.diagnostics' error in .NET apps

.NET can be used to create a variety of different types of app, coming with various technologies such as WPF and Windows Forms to help you create them. .NET apps support providing a .config file with the app that can be used to store various bits of configuration information about the app. There is an issue, however, that you might encounter when adding this file to your project (either manually or automatically, such as when you create a .settings file). The issue is that this file can cause a System.Configuration.ConfigurationErrorsException exception, with an error message that starts with something like 'Unrecognized configuration section system.diagnostics'. Luckily, there is an easy fix for this issue which simply involves adding a single line of code to your config file. The Fix So, to fix the issue, first open your project's configuration file (it will probably be named app.config or something like that) and add the following line under <configSections>: < ...

Desktop.ini: What is it, what can it be used for and what properties does it support?

Image
No doubt you've come across the mysterious 'desktop.ini' file before - especially if you often have hidden files set to show. But what exactly is this file? How can a seemingly empty folder end up with this file? What does it even do? Well, read on to find the answers to all those questions! What is desktop.ini? Desktop.ini is a basic text file that can often be found hidden in folders. Desktop.ini actually stores various properties and information about its parent folder for use by file browsers when displaying the folder. There are various things you can change about how the folder looks by using Desktop.ini, such as setting a ToolTip to display when the user mouses-over the folder or setting custom text to display when the folder is empty. Another use is to specify string resources to use for files in the folder - this allows for localisation, meaning that file names can appear different depending on your system's default language.  Another example is in our app QPad...

WPF: How to enable shadows and rounded corners on ToolTips in Windows 11

Image
Windows 11 originally came out in 2021, however, an official Windows 11 theme has not yet been released for WPF (more on that here ). Because of this, WPF apps still have more of a Windows 8/10 look. Luckily, there are some easy things you can do to modernise your WPF user interfaces . You could of course, create your own custom styles, however this can take quite a bit of work. This article covers something that can be done easily, without much work and without breaking compatibility with older operating systems. Enabling shadows and rounded corners on ToolTips WPF presents its ToolTips in seperate top level windows. This allows them to easily show on top of other content and not be limited to the size and position of its parent window. Windows 11 includes a built in feature as part of the DWM (Desktop Window Manager) that rounds top level windows. You can control this feature using the DwnSetWindowAttribute Windows function. Using this function, we can tell Windows 11 to have the DW...