AiForms.SettingsView icon indicating copy to clipboard operation
AiForms.SettingsView copied to clipboard

PickerCell: Bind Enum

Open zimmerrol opened this issue 7 years ago • 5 comments

I would like to use the PickerCell together with an enum. Doing this, I want to set the DisplayMember property of the picker and set its value to a converter, so that I can convert the enum values into readable values. In a normal Xamarin.Forms.Picker this works without a problem - sadly here, it does not. Is this the intended behavior of the property? Is it possible to implement a similar behavior?

zimmerrol avatar Jan 26 '18 10:01 zimmerrol

@FlashTek

DisplayMember must be Class member name. So if the value is changed by a converter, it won't correctly work.

PickerCell is different from Xamarin.Forms.Picker at all. This behavior is my intention. For now, I am not going to plan to implement it.

Thanks.

muak avatar Jan 29 '18 09:01 muak

I would upvote this also. However, it's easy enough to convert an enum to an IEnumerable. This doesn't seem to work either an ItemSource. Does PickerCell require a collection of complex objects?

codegrue avatar Mar 01 '18 16:03 codegrue

@codegrue

ItemsSource in PickeCell must be GenericType, which is necessary to get dynamically property member.

muak avatar Mar 20 '18 02:03 muak

intention

Hi @muak , I'm new in Xamarin and really love your design and implementation. Actually, I'm facing a similar problem here, I would argue that sometimes the app needs a <Key, Value> list to do something for the picker (or PickerCell). Also, that would be the way how we save the picker values in the database (with key and value). ps: I tried to find the picker in the solution until I saw this "different from picker" here.

shawyunz avatar Apr 04 '19 00:04 shawyunz

@Shaw6157 Thank you for your opinion. I will think about it a little.

muak avatar Apr 15 '19 01:04 muak