Categories
.NET .NET 9 .NET MAUI Android Blazor C# Code Desktop Developer Hybrid iOS Issue macOS Mobile Preview Quick Fix Web Windows

.NET MAUI 9 Preview 5 XAML Compilation Issue: Resolving Content Property Error

Workaround for the XAMLC issue.

After the installation of .NET MAUI 9 Preview 5, an XAML compilation (XAMLC) issue has arisen.

In general, it is not necessary to explicitly specify the default property such as Content, Children, etc.

The Content is the default property for Page, View, and Toolkit’s Popup, and this XAMLC issue is about the Content property.

If the following error message is encountered during compilation, consider explicitly defining the Content property, as this approach may resolve the issue.

XC0009	No property, BindableProperty, or event found for "Content", or mismatching type between value and property.

ContentPage:

<ContentPage.Content>
<!--- Content goes here -->
</ContentPage.Content>

ContentView:

<ContentView.Content>
<!--- Content goes here -->
</ContentView.Content>

Toolkit’s Popup:

For MAUI Popup follow this approach: Define an intermediate base class and modify your Popups to inherit from it. After the resolution of this issue has been formalized, proceed to remove the overridden Content property.

public class MauiPopup : Popup
{
    public override View? Content
    {
        get => base.Content;
        set => base.Content = value;
    }
}

This issue can be tracked on GitHub here.

Let me know in the comments if this resolves the issue or if you discover any alternative solutions.

Happy coding. Stay connected as we continue to learn and share the experiences from this exciting journey of being a .NET developer.

By Vijay Anand E G

A software professional with over a decade long industry experience in developing products that spans across desktop, mobile, and web.

Discover more from Developer Thoughts

Subscribe now to keep reading and get access to the full archive.

Continue reading