Exemple #1
0
        private void LoadItems()
        {
            if (base.Control == null || _combobox == null || _combobox.ItemsSource == null)
            {
                return;
            }


            _items.Clear();
            foreach (var item in _combobox.ItemsSource)
            {
                string itemValue = string.Empty;
                if (_combobox.ItemDisplayBinding == null)
                {
                    itemValue = item.ToString();
                }
                else
                {
                    itemValue = item.GetPropValue <string>(_combobox.ItemDisplayBinding.ToString());
                }

                _items.Add(itemValue);
            }

            _adapter = new ComboboxArrayAdapter(base.Context, Resource.Drawable.spinner_item, _items);
            _adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);

            base.Control.Adapter       = _adapter;
            base.Control.ItemSelected += spinner_ItemSelected;
        }
Exemple #2
0
        protected override void Dispose(bool disposing)
        {
            if (disposing && !this._isDisposed)
            {
                this._isDisposed = true;
            }

            _items   = null;
            _adapter = null;
            base.Control.ItemSelected -= spinner_ItemSelected;
            base.Dispose(disposing);
        }