Posts

Showing posts from December, 2022

Packaged .Net Core app that uses XAML Host not building? It's a known issue - here's how to fix it.

Image
The XAML Host is a powerful control that allows you to easily use UWP and WinUI 2 controls in a non-UWP application using the XAML Islands feature introduced in Windows 10 1903. Many Microsoft applications use XAML Islands, such as Notepad , Paint , Windows Terminal , the Windows Taskbar, Magnifier, File Explorer and more. Many of our applications using XAML Islands as well such as Codly , LaserCursor , KeepOn , QPad and more . The advantage of XAML Islands, is that you can use modern controls in a non-UWP application, allowing for various things such as better touch support and dark mode support. The XAML Host control makes using XAML Islands in .Net Core and .Net Framework applications easy. Unfortunately, there's an issue with newer versions of Visual Studio 2019 and all versions of Visual Studio 2022 that can prevent packaged applications that use the XAML Host not to build. About the issue If you follow Microsoft's documentation for a packaged app in ' Use XAML Island

Fix ComboBox displaying incorrectly in ViewBox in UWP/WinUI 2

Image
The ComboBox is a commonly used control that can be used for selecting items from a drop down list. Unfortunately, there is a bug in UWP that causes UWP and WinUI 2 ComboBoxes not to display correctly when opened if the ComboBox is inside a ViewBox. The ComboBox's drop down  menu might appear too large or too small and it might appear blurry and/or cut off as well. Here is an example of what it might look like: As you can see in the above screenshot, the ComboBox's drop down menu appears too large, blurred and cut off. What causes this? This issue is caused by a new feature introduced in Windows 10 1903 called ShouldConstrainToRootBounds. ShouldConstrainToRootBounds is a property that determines if a popup should show within its XAML root, or in a separate top level window. By showing the popup in a top level window, rather than in its XAML root, the popup is able to go beyond the bounds of its XAML root. Practically, for a standard UWP app, this means that a popup can display