question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Adding Resource doesn't work in WinUI 3 for desktop

See original GitHub issue

When adding a xaml resource the project doesn’t compile

<Grid.Resources>
     <local:MyClass x:Key="asdf"/>
</Grid.Resources>

Error WMC0026 Cannot add ‘MyClass’ into the dictionary property ‘Resources’, type must be ‘Object’ C:\Projects\XXXXXX\MainWindow.xaml 48

Additionally the Window object has no Resource property.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:4
  • Comments:15 (11 by maintainers)

github_iconTop GitHub Comments

2reactions
ranjeshjcommented, Feb 10, 2021

I don’t think it needs to be DependencyObject in order to be placed in the resource dictionary. If it takes object, that should just work. Perhaps the markup compiler is getting tripped by something. @stevenbrix @alwu-msft any ideas ?

0reactions
RealTommyKleincommented, Mar 25, 2021

Marking as closed since this should be resolved in the 0.5-prerelease version of Project Reunion.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I access Window Resources in WinUI 3
I've just started working on a WinUi 3 (Desktop) project and have got blocked trying to add Window resources to a Window.
Read more >
Application.Resources Property (Windows.UI.Xaml)
This example shows how to declare an app-specific resource (this one creates a common converter class instance that comes from starting templates).
Read more >
Building Modern Desktop Apps—Is WinUI 3.0 the Way to Go?
WinUI 3.0 is the hot new framework for desktop application development. In this post we'll try to answer the questions “What is WinUI...
Read more >
Build Cross-Platform apps with WinUI and Uno Platform
With Uno Platform you can bring your WinUI apps everywhere that WinUI does not natively run– Web/WebAssembly, Linux, macOS, iOS, and Android.
Read more >
Modernizing Your Windows Applications with the Windows App ...
Expand your desktop apps to support new features and deliver an ... You will find a template called Resource Dictionary (WinUI 3) –...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found