示例#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 }
            };
        }
示例#2
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 }
            };
        }