Skip to content

[BUG] BindableProperty Color with DynamicResource and SourceGeneration throws errors on build #3225

@Pastajello

Description

@Pastajello

Is there an existing issue for this?

  • I have searched the existing issues

Did you read the "Reporting a bug" section on Contributing file?

Current Behavior

When you create property:

  [CommunityToolkit.Maui.BindableProperty]
    public partial Color NotWorkingColor { get; set; }

and then try to bind to that property with a DynamicResource:

NotWorkingColor="{x:DynamicResource DummyColor}"

an error happens when building:
0>MainPage.xaml.xsg.cs(102,114): Error CS0030 : Cannot convert type 'Microsoft.Maui.Controls.Internals.DynamicResource' to 'Microsoft.Maui.Graphics.Color'

Expected Behavior

The project builds and BindableProperty generated by the package works like manually created BindableProperty.

Steps To Reproduce

Try to build project.

Link to public reproduction project repository

https://github.com/Pastajello/CTM_BindableProperty_DynamicResource

Environment

- .NET MAUI CommunityToolkit: 14.1.1
- OS: MacOS 26.4.1.
- .NET MAUI: 10.0.70

Anything else?

AutoBindable BindingProperty generator doesnt produce this issue:
https://github.com/rrmanzano/maui-bindableproperty-generator
but produces another with SourceGen :
An error occured while parsing Xaml: The given key 'Microsoft.Maui.Controls.Xaml.ValueNode' was not present in the dictionary

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions