Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Dreamescaper opened this issue Jun 16, 2022 · 0 comments · May be fixed by #461
Open

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

Dreamescaper opened this issue Jun 16, 2022 · 0 comments · May be fixed by #461

Comments

@Dreamescaper
Copy link
Contributor

Dreamescaper commented Jun 16, 2022

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant