Dreamescaper / BlazorBindings.Maui

MAUI Blazor Bindings - Build native and hybrid MAUI apps with Blazor
MIT License
251 stars 23 forks source link

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

Open AmirImam opened 1 year ago

AmirImam commented 1 year ago

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 commented 1 year ago

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