Exemple #1
0
        private async void HandleItemSelected(object sender, AdapterView.ItemSelectedEventArgs e)
        {
            var item = _adapter.GetItem(e.Position);

            if (item != _otherItem)
            {
                if (ItemSelected != null)
                {
                    ItemSelected.Invoke(this, e);
                }
            }
            else
            {
                //binding will send this event, so we need to handle it and not displaying the popup
                string value = null;
                if (_fromUI)
                {
                    value = await this.Services().Message.ShowPromptDialog(this.Services().Localize["OtherListItemLabel"],
                                                                           this.Services().Localize["OtherListItemPromptLabel"], () => { }, true);
                }
                if (OtherValueSelected != null)
                {
                    OtherValueSelected(this, value);
                }
            }
        }
Exemple #2
0
        private void SelectItem()
        {
            var index = -1;

            for (int i = 0; i < _adapter.Count; i++)
            {
                var item = _adapter.GetItem(i);
                if (item.Key.Equals(_selectedKey))
                {
                    index = i;
                    break;
                }
            }
            if (index < 0)
            {
                return;
            }
            if (_spinner != null)
            {
                _spinner.SetSelection(index);
            }
        }