Skip to content
This repository was archived by the owner on Oct 29, 2024. It is now read-only.
This repository was archived by the owner on Oct 29, 2024. It is now read-only.

Update Picker.ItemDisplayBinding to be Func instead of string #460

@Dreamescaper

Description

@Dreamescaper

Currently in our Picker implementation ItemDisplayBinding property has a string type, which represents property name which should be displayed, so if I have the following item type:

class Item
{
	public string Id {get;set;}
	public string Name {get;set;}
}

I can use ItemDisplayBinding="Name" so Picker would use this property for items.

But
a) It has no compile time validation
b) It's not flexible. What if I want to use multiple properties for display item or use custom function?

It should be Func instead (ItemDisplayBinding="i => i.Name").
We can use Maui's TypedBinding to convert Func to Binding to be able to assign it to Maui's control.

One thing I'm not sure about is naming. Does it make sense to rename it to smth like ItemDisplaySelector? Since it has no relation to Maui's Bindings? Or leave it as is?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions