private Spinner CreateSpinner(string[] values, string value, string tooltip = null) { var spinner = new Spinner(new ContextThemeWrapper(context, Resource.Style.LightGrayTextMedium)); var adapter = new CustomFontArrayAdapter(spinner, context, Android.Resource.Layout.SimpleSpinnerItem, values); spinner.Adapter = adapter; spinner.Background.SetColorFilter(BlendModeColorFilterCompat.CreateBlendModeColorFilterCompat(DroidUtils.GetColorFromResources(context, Resource.Color.LightGreyFillColor1), BlendModeCompat.SrcAtop)); spinner.SetSelection(adapter.GetPosition(value)); spinner.ItemSelected += Spinner_ItemSelected; return(spinner); }
public void UpdateDropDownListItems(int idx, string[] values) { var spinner = properties[idx].controls[0] as Spinner; var selIdx = spinner.SelectedItemPosition; var adapter = new CustomFontArrayAdapter(spinner, context, Android.Resource.Layout.SimpleSpinnerItem, values); spinner.Adapter = adapter; if (selIdx >= 0 && selIdx < values.Length) { spinner.SetSelection(selIdx); } else { spinner.SetSelection(0); } }