Ejemplo n.º 1
0
        public SomePage()
        {
            this.Title = "Some Page";

            var header = new Label()
            {
                Text   = "Enter Text:",
                Margin = new Thickness(5, 5, 5, 0)
            };
            var entry = new CoreMaskedEntry()
            {
                Margin = 5
            };

            entry.SetBinding(CoreMaskedEntry.TextProperty, "SomeText");

            var lbl = new Label()
            {
                Margin = 5
            };

            lbl.SetBinding(Label.TextProperty, new Binding(path: "SomeText", converter: CoreSettings.UpperText));

            var btn = new CoreButton()
            {
                Text   = "Some Action",
                Style  = CoreStyles.LightOrange,
                Margin = 5
            };

            btn.SetBinding(Button.CommandProperty, "SomeAction");

            var lstCount = new Label()
            {
                Margin = 5
            };

            lstCount.SetBinding(Label.TextProperty, new Binding(path: "TotalItems", stringFormat: "Total count is {0}"));

            Content = new StackLayout()
            {
                Padding  = 20,
                Children = { header, entry, lbl, btn, lstCount }
            };
        }
        public LocalizationMain()
        {
            this.Title = "Localization";

            var lblGreeting = new Label()
            {
                FontSize = 50,
                HorizontalTextAlignment = TextAlignment.Center,
            };

            lblGreeting.SetBinding(Label.TextProperty, "GreetingText");

            var lblUserName = new Label();

            lblUserName.SetBinding(Label.TextProperty, "UserNameText");

            var txtUserName = new CoreMaskedEntry();
            var lblPassword = new Label();

            lblPassword.SetBinding(Label.TextProperty, "PasswordText");

            var txtPassword = new CoreMaskedEntry()
            {
                IsPassword = true
            };

            var btnLogin = new CoreButton()
            {
                Style        = CoreStyles.LightOrange,
                AutomationId = "errors",
            };

            btnLogin.SetBinding(CoreButton.TextProperty, "LoginText");

            Content = new CoreStackLayout()
            {
                StartColor = Color.White,
                EndColor   = Color.Black,
                Padding    = 20,
                Spacing    = 15,
                Children   = { lblGreeting, lblUserName, txtUserName, lblPassword, txtPassword, btnLogin }
            };
        }
Ejemplo n.º 3
0
        public AddPerson()
        {
            this.Title = "Add Person";

            var lblFirstName = new Label()
            {
                Text   = "First Name:",
                Margin = new Thickness(5, 5, 5, 0)
            };
            var txtFirstName = new CoreMaskedEntry()
            {
                Margin = 5
            };

            txtFirstName.SetBinding(CoreMaskedEntry.TextProperty, "FirstName");

            var lblLastName = new Label()
            {
                Text   = "Last Name",
                Margin = new Thickness(5, 5, 5, 0)
            };
            var txtLastName = new CoreMaskedEntry()
            {
                Margin = 5
            };

            txtLastName.SetBinding(CoreMaskedEntry.TextProperty, "LastName");

            var btnAddPerson = new CoreButton()
            {
                Text   = "Add Person",
                Style  = CoreStyles.LightOrange,
                Margin = 5
            };

            btnAddPerson.SetBinding(Button.CommandProperty, "AddPerson");

            Content = new StackLayout()
            {
                Padding  = 20,
                Children = { lblFirstName, txtFirstName, lblLastName, txtLastName, btnAddPerson }
            };
        }