Venky
Venky

Reputation: 2047

Unable to resolve InitializeComponent in colors.xaml.cs and styles.xaml.cs

I'm trying to create a MAUI project from my existing forms project, and as part of it I created two resources files, one for colors and the other for styles, but it says that it cannot find the InitializeComponent method in it, I've tried cleaning bin, obj, restarting VS, creating new Resource files, but it is still giving the error

Any inputs would be really helpful

Upvotes: 0

Views: 88

Answers (1)

Andrew KeepCoding
Andrew KeepCoding

Reputation: 13331

Usually, resources and styles are defined in *.xaml files without *.xaml.cs. Can you try adding a new ResourcesDictionary file and define your resources or styles there?

A ResourceDictionary file should look like this:

<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:SampleApp">

</ResourceDictionary>

Upvotes: 0

Related Questions