Closed kikisaints closed 1 year ago
Looks like app level resource overriding is broken. @jevansaks is this a known bug? I tried compact resources and they didn't seem to work either.
I don't know off the top of my head. I know that you, @licanhua and @stephenlpeters had done various investigations here. Is there a summary of those investigations? My guess is that at the end of the day there's a framework bug (or more than one). Maybe you can sit with Bartek and figure out the problem(s) and next steps?
Yeah there was a framework bug for popup based control resource overrides (which makes OverlayCornerRadius not work). But this one, looks like the override doesn't work at all in app level, which feels like a bigger problem. I'll ask Bartek...
Any updates on this one?
The bug also applies to the several control-specific border thickness resources (such as TextControlBorderThemeThickness
).
I've tried to reproduce the issue, but using the XCG as test project, and adding
<CornerRadius x:Key="ControlCornerRadius">0,0,0,0</CornerRadius>
to the ResourceDictionary of App.xaml, components that use this resource (e.g. buttons) seem to render correctly and without rounded corners.
@chingucoding Tested it on my local machine with the latest release and preview-release versions of WinUI (no WinUI 3.0) and SDK 18362 and the resource override is still not applied when located in App.xaml. Are you already running on 19H2 and if yes, could the fix for this issue be at the OS level then? 🤔
@Felix-Dev I am running the Insider version 19018.
Maybe this is really a bug that lays inside the OS, though I am very confused why that would be something inside the OS.
If you are using the same WinUI 2.x build and it works on a newer OS version but not an older one, it is possible that the bug is in the framework (wux.dll which currently ships with the OS). wux.dll is being moved out of the OS into WinUI 3 currently.
@ranjeshj Any chance the fix, if one does exist for newer windows insider builds, will be backported to current windows versions? Or will we have to wait for WinUI 3.0?
I would like to understand better if this is really a framework bug. @kaiguo - were you able to identify/root case this issue to a framework bug that was fixed ? Is there a workaround ? @Felix-Dev, if this is a framework bug, it will be fixed in WinUI 3 and you will likely have to workaround in the mean time unfortunately.
Yeah I did some investigations earlier, I think it's more of a "limitation" rather than a bug...
My understand is this has something to do with the way we read resources, when ControlCornerRadius (or any app level overloading resource) is getting loaded, Application.Resources hasn't been loaded yet (value is still null) , we don't have look ahead ability so there's nothing to override. @ranjeshj I forwarded you an email with some more info.
But yeah, this is definitely a framework issue and we'd have to wait for WinUI 3. The workaround will be overriding the resource in page or control level instead of app level.
Linking internal bug link - https://microsoft.visualstudio.com/OS/_workitems/edit/20908500 FYI @chrisglein in case he wants to add more details to this conversation.
This is an known restriction from platform(#430), and it's impossible to fix it in WinUI 2.
This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 5 days.
Describe the bug
When I target the newest release of WinUI (2.2) or even the current pre-release (2.3) and I attempt to set the
ControlCornerRadius
resource at the app-level. Either by directly declaring it inApp.Resources
or by merging in a ResourceDictionary at the app-level - theControlCornerRadius
resource fails to apply to the controls on my page.However, if I merge that same dictionary in at the page-level, or declare the resource at the page-level it will apply to my controls correctly.
Steps to reproduce the bug
Steps to reproduce the behavior:
ControlCornerRadius
resource at the App.xaml levelControlCornerRadius
resourcesExpected behavior
I would expect at both the page-level and the app-level that the
ControlCornerRadius
would effect all controls under the respective scope.Version Info
NuGet package version: Microsoft.UI.Xaml 2.3.190917002