コード例 #1
0
        public override void ConstructUI()
        {
            base.ConstructUI();

            nameLabel = new Label
            {
                Style             = (Style)App.Current.Resources["whiteTextLabel"],
                Text              = "Name",
                HorizontalOptions = LayoutOptions.Start
            };
            shortDescriptionLabel = new Label
            {
                Style             = (Style)App.Current.Resources["whiteTextLabel"],
                Text              = "Short Description",
                HorizontalOptions = LayoutOptions.Start
            };
            priceLabel = new Label
            {
                Style             = (Style)App.Current.Resources["whiteTextLabel"],
                Text              = "Price",
                HorizontalOptions = LayoutOptions.Start
            };
            dateLabel = new Label
            {
                Style             = (Style)App.Current.Resources["whiteTextLabel"],
                Text              = "Date of Expense",
                HorizontalOptions = LayoutOptions.Start
            };

            nameEntry = new Entry
            {
                Style                   = (Style)App.Current.Resources["underlinedEntry"],
                AutomationId            = "expenseNameEntry",
                HorizontalTextAlignment = TextAlignment.End,
                PlaceholderColor        = Color.FromHex("#E8E8E8"),
                Placeholder             = "Vendor Name"
            };
            shortDescriptionEntry = new Entry
            {
                Style                   = (Style)App.Current.Resources["underlinedEntry"],
                AutomationId            = "shortDescriptionEntry",
                HorizontalTextAlignment = TextAlignment.End
            };
            priceEntry = new Entry
            {
                Style                   = (Style)App.Current.Resources["underlinedEntry"],
                AutomationId            = "priceEntry",
                HorizontalTextAlignment = TextAlignment.End,
                Keyboard                = Keyboard.Numeric,
                PlaceholderColor        = Color.FromHex("#E8E8E8"),
                Placeholder             = "$0.00"
            };
            date = new ExpenseDatePicker
            {
                AutomationId      = "expenseDatePicker",
                HorizontalOptions = LayoutOptions.End
            };

            saveButton = new Button
            {
                Style           = (Style)App.Current.Resources["borderedButton"],
                AutomationId    = "saveExpenseButton",
                Text            = "Save",
                VerticalOptions = LayoutOptions.End
            };
            cancelButton = new Button
            {
                Style           = (Style)App.Current.Resources["borderedButton"],
                AutomationId    = "cancelExpenseButton",
                Text            = "Cancel",
                VerticalOptions = LayoutOptions.EndAndExpand
            };
            addReceipt = new Image
            {
                AutomationId = "addReceiptButton",
                Source       = "ic_insert_photo_white_48dp.png"
            };

            formLayout = new RelativeLayout();
        }