Exemplo n.º 1
0
        private async Task Initialise()
        {
            _voucherService  = new VoucherService();
            _voucherResponse = await _voucherService.GetVouchers();

            var vouchersList = new List <string> {
                "Select Voucher"
            };

            vouchersList.AddRange(_voucherResponse.Select(x => x.Description).ToList());

            var spnVoucher = FindViewById <Spinner>(Resource.Id.spnVoucher);

            spnVoucher.ItemSelected += Voucher_OnSelected;

            var voucherAdapter = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleSpinnerItem, vouchersList);

            voucherAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            spnVoucher.Adapter = voucherAdapter;
        }