예제 #1
0
        private void initCurrencyPicker()
        {
            this.pickerLabelText = new Label
            {
                Text              = "Total Amount Currency",
                FontSize          = Device.GetNamedSize(NamedSize.Small, typeof(Label)),
                HorizontalOptions = LayoutOptions.Center
            };

            this.totalCurrencyPicker = new CurrencyPicker(this.currencies);
            // Set selected index to default currency
            this.totalCurrencyPicker.SelectedIndex = currencies.FindIndex(x => x.Code == Currency.DefaultCurrency);
            // Add event handler
            this.totalCurrencyPicker.SelectedIndexChanged += (sender, args) =>
            {
                if (totalCurrencyPicker.SelectedIndex == -1)
                {
                    totalAmountText.Text = "Total Amount: " +
                                           myWallet.totalAmount(Currency.DefaultCurrency).ToString("n2") + " " + Currency.DefaultCurrency;
                }
                else
                {
                    this.UpdateTotalAmount();
                }
            };
        }
예제 #2
0
        private void initCurrencyPicker()
        {
            this.amountEntry = new Entry
            {
                Placeholder = "Amount",
                FontSize    = Device.GetNamedSize(NamedSize.Small, typeof(Label))
            };

            this.currencyPicker = new CurrencyPicker(this.currencies);
            // Set selected index to default currency
            this.currencyPicker.SelectedIndex = currencies.FindIndex(x => x.Code == Currency.DefaultCurrency);
        }