How to bind ItemDisplayBinding of a picker control? #317
Unanswered
touchofevil-dev
asked this question in
Q&A
Replies: 1 comment
-
shure too late for you, but perhaps somebody can be helped: var languagePicker = new Picker
{
BackgroundColor = Colors.Transparent,
TextColor = Colors.White,
ItemDisplayBinding = Binding.Create<CultureInfo, string>(static (CultureInfo ci) => ci.NativeName,
mode: BindingMode.OneWay),
}
.Bind(Picker.ItemsSourceProperty,
getter: static (AppShellViewModel vm) => AppShellViewModel.Cultures,
mode: BindingMode.OneWay)
.Bind(Picker.SelectedIndexProperty,
getter: static (AppShellViewModel vm) => vm.SelectedLanguageIndex,
setter: static (AppShellViewModel vm, int value) => vm.SelectedLanguageIndex = value); |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I am trying to create a MAUI app using C# code. While looking into that I was wondering, how do we set ItemDisplayBinding property of a Picker control using Maui.Markup library?
I have tried below, but couldn't figure this out.
Of course I could create this picker separately and then do
However I was wondering if there was another way of achieving the same in a more fluent-like manner?
Beta Was this translation helpful? Give feedback.
All reactions