Skip to content

[BUG] Picker ItemDisplayBinding #392

@fgonc124

Description

@fgonc124

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

I'm trying to use c# makup to create a Picker . When I define the Picker I get an error saying that ItemDisplayBinding property does not exist.

I tried using the following code but I still get an error "Non-invocable member 'Picker.ItemDisplayBinding' cannot be used like a method."

                new Picker()
                    //.Title("Choose a Person")
                    .Bind(Picker.ItemsSourceProperty, static (MainViewModel vm) => vm.People) // Bind ItemsSource to your collection
                    // Fluent ItemDisplayBinding using a lambda expression:
                    .

(Binding.Create<Person, string>(static (item) => item.Name)) // THIS IS THE KEY!

                    .Margin(10)

Expected Behavior

I should be able to use property ItemDisplayBinding .

Steps To Reproduce

https://github.com/fgonc124/ItemDisplayBinding

Link to public reproduction project repository

https://github.com/fgonc124/ItemDisplayBinding

Environment

- .NET MAUI C# Markup CommunityToolkit: 4.0, 5.0 or 6.0.0
- .NET MAUI C# Markup CommunityToolkit.maui 12.1.0
- OS: Windows 11 24H2
- Microsoft Maui Controls:9.0.81
- Net 9.0 Runtime
- .NET MAUI:
- Visual Studio 17.14.7 Preview

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingunverifiedBug has not been verified by maintainers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions