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

Picker ItemDisplayBinding doesn't work as it is supposed to #142

Open
AmirImam opened this issue Sep 11, 2023 · 1 comment
Open

Picker ItemDisplayBinding doesn't work as it is supposed to #142

AmirImam opened this issue Sep 11, 2023 · 1 comment

Comments

@AmirImam
Copy link

Hi
I want to display a text in the picker according to the value. Like this:
Razor Code:
<Picker ItemsSource="worldsSource" ItemDisplayBinding=@(e=> e==null?"All":"+"+e.ToString()) />
C# Code:

//WorldTypes is an enum
private List<WorldTypes?> worldsSource = new()
    {
         null,WorldTypes.OpenWorld,WorldTypes.Linear,WorldTypes.Mix
    };

The result is correct in all values except the null one. It must appear as "All" text but it shows an empty text

image

Is there something wrong with my code?

@Dreamescaper
Copy link
Owner

Unfortunately, that seems to be MAUI's behavior. It doesn't even invoke this Func for null items.

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

No branches or pull requests

2 participants