Fix WinUI resource loading so if users replace resource keys in the platform App.Xaml file those will take precedence
- Dominant language
- C#
- Stars
- 23.3k
- Forks
- 2k
- Avg merge
- 1d 10h
- Merged PRs (30d)
- 306
Description
Create a new .NET MAUI App
Add the following resource to the WinUI Head
```XAML
<Setter Property="Background" Value="Transparent" />
<Setter Property="Foreground" Value="{ThemeResource SystemControlForegroundBaseHighBrush}" />
<Setter Property="TabNavigation" Value="Local" />
<Setter Property="IsHoldingEnabled" Value="True" />
<Setter Property="Padding" Value="0, 0, 0, 0" />
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="MinWidth" Value="{ThemeResource ListViewItemMinWidth}" />
<Setter Property="MinHeight" Value="0" />
```
Now when you run the application you will get a crash because the `DefaultListViewItemStyle` is part of the WinUI Resources which are inserted after this style
Contributor guide
Research direction
The report identifies the WinUI Head resource declaration and the DefaultListViewItemStyle lookup; start by tracing where WinUI resources are inserted relative to MauiWinUIApplication.Resources. Reproduce the crash in a new .NET MAUI app with the shown XAML, then verify that an App.Xaml resource-key replacement takes precedence without crashing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100