Binding Spinner with Text and Value

rach_12rach_12 USMember ✭✭

Hi,

How to bind the spinner with Key,Value pair data ? For example, I have a colorId and colorName. How to bind colorName as text and colorId as value similar to a dropdownlist? Help please.
I tried to add the dictionary as shown in the below code.
But it does not display the colorName in the Spinner. Can you please let me know what more changes do I need to do here?

var adapter = new ArrayAdapter<Dictionary<string,string>>(this, Android.Resource.Layout.SimpleSpinnerItem);
adapter.Add(colorList);
adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerItem);
spnColor.Adapter = adapter;

Regards,
Rachel

Sign In or Register to comment.