Пример #1
0
        //https://developer.apple.com/library/ios/technotes/tn2154/_index.html
        //Pure approach
        public AutoLayoutContentView AddScrollView(string name, UIColor color)
        {
            var scrollView = new UIScrollView();

            this.Add(scrollView);
            scrollView.Frame = new RectangleF(10, 10, 10, 10);             // TODO: Is this still required?
            AutoLayoutContentView contentView = new AutoLayoutContentView(name, color, Font);

            contentView.Frame = new RectangleF(10, 10, 10, 10);             // TODO: Is this still required?
            scrollView.Add(contentView);

            // Setup constraints
            scrollView.TranslatesAutoresizingMaskIntoConstraints  = false;
            contentView.TranslatesAutoresizingMaskIntoConstraints = false;
            OurConstraints.ViewNames.Add(new NSString("PrivateScrollView"));
            OurConstraints.Views.Add(scrollView);
            int width  = (int)this.Bounds.Size.Width;
            int height = (int)this.Bounds.Size.Height;

            AddConstraint("H:|[PrivateScrollView(" + width + ")]|");
            AddConstraint("V:|[PrivateScrollView(>=" + height + ")]|");
            AutoLayoutConstraints ScrollViewConstraints = new AutoLayout.AutoLayoutConstraints();

            ScrollViewConstraints.ViewNames.Add(new NSString("PrivateContentView"));
            ScrollViewConstraints.Views.Add(contentView);
            AddConstraint("H:|[PrivateContentView(" + width + ")]|", scrollView, ScrollViewConstraints);
            AddConstraint("V:|[PrivateContentView(>=" + height + ")]|", scrollView, ScrollViewConstraints);

            OurConstraints.ViewNames.Add(new NSString(name));
            OurConstraints.Views.Add(contentView);
            contentView.Parent = Parent;
            return(contentView);
        }
Пример #2
0
 private AutoLayoutContentView(string name, AutoLayoutContentView parent, UIColor color, String font, float x = 10, float y = 10, float width = 10, float height = 10)
 {
     Font                 = font;
     OurConstraints       = new AutoLayoutConstraints();
     Parent               = parent;
     base.BackgroundColor = color;
     Name                 = name;
     base.TranslatesAutoresizingMaskIntoConstraints = false;
     if (parent == null)
     {
         base.Frame = new RectangleF(0, 0, (float)UIScreen.MainScreen.Bounds.Width, (float)UIScreen.MainScreen.Bounds.Height);
     }
     else
     {
         base.Frame = new RectangleF(x, y, width, height);                 // Is this still required?
     }
     if (parent != null)
     {
         parent.Add(this);
         Parent.OurConstraints.ViewNames.Add(new NSString(Name));
         Parent.OurConstraints.Views.Add(this);
     }
     // Add to ourself as well.
     OurConstraints.ViewNames.Add(new NSString(Name));
     OurConstraints.Views.Add(this);
 }
Пример #3
0
        public static AutoLayoutContentView CreateRoot(string name, UIColor color, string font)
        {
            AutoLayoutContentView root = new AutoLayoutContentView(name, null, color, font);

            root.TranslatesAutoresizingMaskIntoConstraints = true;
            return(root);
        }
        void SetComponents(MvxFluentBindingDescriptionSet<SimpleExampleView, SimpleExampleViewModel> Set, AutoLayoutContentView ComponentsBorder)
        {
            var button1 = ComponentsBorder.AddButton ("Button1", "Scroll Example", UIColor.Green, UIColor.White, 12);
            ComponentsBorder.AddActivityIndicator ("ActivityIndicator", UIColor.Blue);
            ComponentsBorder.AddPageControl ("PageControl", UIColor.Blue);
            ComponentsBorder.AddProgressView ("ProgressView", UIColor.Blue);
            ComponentsBorder.AddSlider ("Slider", UIColor.Blue);
            ComponentsBorder.AddSwitch ("Switch", UIColor.Blue);
            ComponentsBorder.AddSegmentedControl ("SegmentedControl", UIColor.Blue);
            // We can add in other UIViews that don't have their own bespoke Add methods.
            var button2 = (UIButton)ComponentsBorder.AddView ("Button2", UIButton.FromType (UIButtonType.RoundedRect));
            button2.SetTitle ("List Example", UIControlState.Normal);
            ComponentsBorder.AddConstraint ("V:|-[Button1(20)]-[ActivityIndicator(60)]-[PageControl(50)]-[ProgressView(50)]-[Slider]-[Switch]-[SegmentedControl]-|");
            ComponentsBorder.AddConstraint ("V:|-[Button2(20)]-(>=8)-|");
            ComponentsBorder.AddConstraint ("H:|-[Button1(<=100)]-[Button2(<=100)]-(>=8)-|");

            // TODO: these controls still need some beautification and MVX binding.

            ComponentsBorder.AddConstraint ("H:|-[ActivityIndicator(60)]-(>=8)-|");
            ComponentsBorder.AddConstraint ("H:|-[PageControl(50)]-(>=8)-|");
            ComponentsBorder.AddConstraint ("H:|-[ProgressView(50)]-(>=8)-|");
            ComponentsBorder.AddConstraint ("H:|-[Slider(100)]-(>=8)-|");
            ComponentsBorder.AddConstraint ("H:|-[Switch]-(>=8)-|");
            ComponentsBorder.AddConstraint ("H:|-[SegmentedControl]-(>=8)-|");

            Set.Bind (button1).For ("Tap").To (vm => vm.GotoScrollView).WithConversion ("CommandParameter", "scrollView");
            Set.Bind (button2).For ("Tap").To (vm => vm.GotoListView).WithConversion ("CommandParameter", "listView");
        }
Пример #5
0
        public AutoLayoutContentView AddContainerCenteredX(string name, UIColor color)
        {
            AutoLayoutContentView view = AddContainer(name, color);

            AddConstraintToCenterX(view);
            return(view);
        }
        private UIView BuildView()
        {
            var Set = this.CreateBindingSet <ScrollExampleView, ScrollExampleViewModel> ();

            var Root       = AutoLayoutContentView.CreateRoot("Root", UIColor.DarkGray, "Helvetica-Bold");
            var ScrollView = Root.AddScrollView("ScrollView", UIColor.DarkGray);
            var button1    = ScrollView.AddButton("Button1", "Simple Example", UIColor.Green, UIColor.White, 6);

            ScrollView.AddConstraint("V:|[Button1]-(>=8)-|");
            ScrollView.AddConstraint("H:|-4-[Button1]-(>=8)-|");
            Set.Bind(button1).For("Tap").To(vm => vm.GotoSimpleView).WithConversion("CommandParameter", "simpleView");


            var ContactBorder1 = ScrollView.AddContainer("ContactBorder1", UIColor.White);
            var ContactBorder2 = ScrollView.AddContainer("ContactBorder2", UIColor.White);
            var ContactBorder3 = ScrollView.AddContainer("ContactBorder3", UIColor.White);
            var ContactBorder4 = ScrollView.AddContainer("ContactBorder4", UIColor.White);

            ScrollView.AddConstraint("V:|-16-[ContactBorder1]-[ContactBorder2]-[ContactBorder3]-[ContactBorder4]-(>=100)-|");
            ScrollView.AddConstraint("H:|-4-[ContactBorder1]-4-|");
            ScrollView.AddConstraint("H:|-4-[ContactBorder2]-4-|");
            ScrollView.AddConstraint("H:|-4-[ContactBorder3]-4-|");
            ScrollView.AddConstraint("H:|-4-[ContactBorder4]-4-|");

            SetCustomerAndContact(ContactBorder1);
            SetCustomerAndContact(ContactBorder2);
            SetCustomerAndContact(ContactBorder3);
            SetCustomerAndContact(ContactBorder4);

            return(Root);
        }
 void SetCustomer(AutoLayoutContentView Customer)
 {
     Customer.AddLabel ("CustomerLabel", "CUSTOMER", UIColor.LightGray, LabelTextSize);
     var name = Customer.AddLabel ("CustomerName", "Alex Eadie", UIColor.Black, DataTextSize);
     Customer.AddConstraint ("V:|-18-[CustomerLabel]-7-[CustomerName]|");
     Customer.AddConstraint ("H:|-19-[CustomerLabel]-(>=8)-|");
     Customer.AddConstraint ("H:|-19-[CustomerName]-(>=8)-|");
 }
 static void SetPremisesDirections(MvxFluentBindingDescriptionSet<TicketView, TicketViewModel> Set, AutoLayoutContentView PremisesBorder)
 {
     var PremisesDirectionsBox = PremisesBorder.AddContainer ("PremisesDirectionsBox", UIColor.White);
     PremisesDirectionsBox.AddLabelCenteredX ("PremisesDirections", "Directions", UIColor.Blue, 12);
     PremisesDirectionsBox.AddImageCenteredX ("PremisesDirectionsImage", "ic_directions.png");
     PremisesDirectionsBox.AddConstraint ("V:|[PremisesDirectionsImage(36)]-3-[PremisesDirections]|");
     PremisesDirectionsBox.AddConstraint ("H:|-(>=1)-[PremisesDirectionsImage(36)]-(>=1)-|");
     PremisesDirectionsBox.AddConstraint ("H:|-(>=1)-[PremisesDirections]-(>=1)-|");
 }
        void SetCustomer(AutoLayoutContentView Customer)
        {
            Customer.AddLabel("CustomerLabel", "CUSTOMER", UIColor.LightGray, LabelTextSize);
            var name = Customer.AddLabel("CustomerName", "Alex Eadie", UIColor.Black, DataTextSize);

            Customer.AddConstraint("V:|-18-[CustomerLabel]-7-[CustomerName]|");
            Customer.AddConstraint("H:|-19-[CustomerLabel]-(>=8)-|");
            Customer.AddConstraint("H:|-19-[CustomerName]-(>=8)-|");
        }
 void SetContact(AutoLayoutContentView Contact)
 {
     Contact.AddLabel ("ContactLabel", "CONTACT", UIColor.LightGray, LabelTextSize);
     var name = Contact.AddLabel ("ContactName", "Natasha Eadie", UIColor.Black, DataTextSize);
     var phone = Contact.AddLabel ("ContactPhone", "0412 123 456", UIColor.Black, DataTextSize);
     Contact.AddConstraint ("V:|[ContactLabel]-3-[ContactName]-3-[ContactPhone]-18-|");
     Contact.AddConstraint ("H:|-19-[ContactLabel]-(>=8)-|");
     Contact.AddConstraint ("H:|-19-[ContactName]-(>=8)-|");
     Contact.AddConstraint ("H:|-19-[ContactPhone]-(>=8)-|");
 }
        void SetCustomerAndContact(AutoLayoutContentView ContactBorder)
        {
            var Customer = ContactBorder.AddContainer("Customer", UIColor.White);
            var Contact  = ContactBorder.AddContainer("Contact", UIColor.White);

            ContactBorder.AddConstraint("V:|-[Customer]-25-[Contact]|");
            ContactBorder.AddConstraint("H:|-[Customer]-(>=8)-|");
            ContactBorder.AddConstraint("H:|-[Contact]-(>=8)-|");
            SetCustomer(Customer);
            SetContact(Contact);
        }
        void SetContact(AutoLayoutContentView Contact)
        {
            Contact.AddLabel("ContactLabel", "CONTACT", UIColor.LightGray, LabelTextSize);
            var name  = Contact.AddLabel("ContactName", "Natasha Eadie", UIColor.Black, DataTextSize);
            var phone = Contact.AddLabel("ContactPhone", "0412 123 456", UIColor.Black, DataTextSize);

            Contact.AddConstraint("V:|[ContactLabel]-3-[ContactName]-3-[ContactPhone]-18-|");
            Contact.AddConstraint("H:|-19-[ContactLabel]-(>=8)-|");
            Contact.AddConstraint("H:|-19-[ContactName]-(>=8)-|");
            Contact.AddConstraint("H:|-19-[ContactPhone]-(>=8)-|");
        }
Пример #13
0
        public static AutoLayoutContentView CreateListContentRoot(string name, UIColor color, UIView view, string font)
        {
            AutoLayoutContentView root = new AutoLayoutContentView(name, null, color, font);

            root.TranslatesAutoresizingMaskIntoConstraints = true;
            int width  = (int)view.Bounds.Size.Width;
            int height = (int)view.Bounds.Size.Height;

            root.Frame = new RectangleF(0, 0, width, height);
            return(root);
        }
 static void SetPremises(MvxFluentBindingDescriptionSet<TicketView, TicketViewModel> Set, AutoLayoutContentView PremisesBorder)
 {
     var address = PremisesBorder.AddLabel ("PremisesAddress", "UNIT 103, 402 DRAYTON-WELLCAMP RD PARRAMATTA", UIColor.Black, 15);
     Set.Bind (address).To (vm => vm.Hello);
     SetPremisesDirections (Set, PremisesBorder);
     PremisesBorder.AddConstraint ("V:|[PremisesTabBox(55)]-20-[PremisesAddress(60)]-18-|");
     PremisesBorder.AddConstraint ("V:|[ExchangeTabBox(55)]-20-[PremisesAddress(60)]-18-|");
     PremisesBorder.AddConstraint ("V:|[ConnectionPillarTabBox(55)]-20-[PremisesAddress(60)]-18-|");
     PremisesBorder.AddConstraint ("V:|[PremisesTabBox(55)]-28-[PremisesDirectionsBox]-(>=8)-|");
     PremisesBorder.AddConstraint ("H:|[PremisesTabBox]-2-[ConnectionPillarTabBox(==PremisesTabBox)]-2-[ExchangeTabBox(==PremisesTabBox)]|");
     PremisesBorder.AddConstraint ("H:|-19-[PremisesAddress(<=200)]-(>=6)-[PremisesDirectionsBox(66)]-10-|");
 }
        static void SetPremisesTabs(MvxFluentBindingDescriptionSet<TicketView, TicketViewModel> Set, AutoLayoutContentView PremisesBorder)
        {
            var PremisesTabBox = PremisesBorder.AddContainer ("PremisesTabBox", UIColor.White);
            var ConnectionPillarTabBox = PremisesBorder.AddContainer ("ConnectionPillarTabBox", UIColor.LightGray);
            var ExchangeTabBox = PremisesBorder.AddContainer ("ExchangeTabBox", UIColor.LightGray);
            var PremisesLabel = PremisesTabBox.AddLabelCenteredXY ("PremisesTab", "PREMISES", UIColor.Black, 15);
            ConnectionPillarTabBox.AddLabelCenteredXY ("ConnectionPillarTab", "P74", UIColor.Blue, 15);
            ExchangeTabBox.AddLabelCenteredXY ("ExchangeTab", "PARR", UIColor.Blue, 15);

            Set.Bind (PremisesTabBox).For ("Tap").To (vm => vm.TestCommand).WithConversion ("CommandParameter", "alex");
            // https://github.com/MvvmCross/MvvmCross/wiki/Value-Converters
            Set.Bind (PremisesTabBox).For (field => field.BackgroundColor).To (vm => vm.PremisesTabBackgroundColor).WithConversion ("RGBA");
            Set.Bind (PremisesLabel).For (field => field.TextColor).To (vm => vm.PremisesTabTextColor).WithConversion ("RGBA");
            SetPremises (Set, PremisesBorder);
        }
 void SetProfile(MvxFluentBindingDescriptionSet<SimpleExampleView, SimpleExampleViewModel> Set, AutoLayoutContentView ProfileBorder)
 {
     var Details = ProfileBorder.AddContainer ("Details", UIColor.White);
     var Photo = ProfileBorder.AddContainer ("Photo", UIColor.White);
     ProfileBorder.AddConstraint ("V:|-[Details]-|");
     ProfileBorder.AddConstraint ("V:|-[Photo]-(>=8)-|");
     ProfileBorder.AddConstraint ("H:|-[Details]-(>=8)-[Photo]-|");
     Photo.AddImageCenteredX ("Picture", "Alex.jpg");
     Photo.AddConstraint ("H:|[Picture(48)]|");
     Photo.AddConstraint ("V:|[Picture(64)]|");
     Details.AddLabelLeft ("Name", "Alex Eadie", UIColor.Black, 12);
     Details.AddLabelLeft ("Phone", "0456 234 154", UIColor.Blue, 12);
     Details.AddLabelLeft ("Email", "*****@*****.**", UIColor.Blue, 12);
     Details.AddConstraint ("V:|[Name]-[Phone]-[Email]-(>=8)-|");
 }
Пример #17
0
        private UIView BuildView()
        {
            var Set        = this.CreateBindingSet <TicketView, TicketViewModel> ();
            var Root       = AutoLayoutContentView.CreateRoot("Root", UIColor.DarkGray, "Helvetica-Bold");
            var ScrollView = Root.AddScrollView("ScrollView", UIColor.DarkGray);

            var ContactBorder  = ScrollView.AddContainer("ContactBorder", UIColor.White);
            var PremisesBorder = ScrollView.AddContainer("PremisesBorder", UIColor.White);

            ScrollView.AddConstraint("V:|-16-[ContactBorder]-300-[PremisesBorder]-(>=4)-|");
            ScrollView.AddConstraint("H:|-4-[ContactBorder]-4-|");
            ScrollView.AddConstraint("H:|-4-[PremisesBorder]-4-|");

            SetCustomerAndContact(Set, ContactBorder);

            SetPremisesTabs(Set, PremisesBorder);

            Set.Apply();

            return(Root);
        }
 private AutoLayoutContentView(string name, AutoLayoutContentView parent, UIColor color, String font, float x = 10, float y = 10, float width = 10, float height = 10)
 {
     Font = font;
     OurConstraints = new AutoLayoutConstraints ();
     Parent = parent;
     base.BackgroundColor = color;
     Name = name;
     base.TranslatesAutoresizingMaskIntoConstraints = false;
     if (parent == null) {
         base.Frame = new RectangleF (0, 0, (float)UIScreen.MainScreen.Bounds.Width, (float)UIScreen.MainScreen.Bounds.Height);
     } else {
         base.Frame = new RectangleF (x, y, width, height);// Is this still required?
     }
     if (parent != null) {
         parent.Add (this);
         Parent.OurConstraints.ViewNames.Add (new NSString (Name));
         Parent.OurConstraints.Views.Add (this);
     }
     // Add to ourself as well.
     OurConstraints.ViewNames.Add (new NSString (Name));
     OurConstraints.Views.Add (this);
 }
        private UIView BuildView()
        {
            var Set  = this.CreateBindingSet <SimpleExampleView, SimpleExampleViewModel> ();
            var Root = AutoLayoutContentView.CreateRoot("Root", UIColor.DarkGray, "Helvetica-Bold");

            NavigationController.NavigationBarHidden = true;


            var ProfileBorder    = Root.AddContainer("ProfileBorder", UIColor.White);
            var ComponentsBorder = Root.AddContainer("ComponentsBorder", UIColor.White);

            Root.AddConstraint("V:|-16-[ProfileBorder(80)]-4-[ComponentsBorder]-(>=4)-|");
            Root.AddConstraint("H:|-4-[ProfileBorder]-4-|");
            Root.AddConstraint("H:|-4-[ComponentsBorder]-4-|");

            SetProfile(Set, ProfileBorder);
            SetComponents(Set, ComponentsBorder);


            Set.Apply();

            return(Root);
        }
Пример #20
0
        static void SetPremisesDirections(MvxFluentBindingDescriptionSet <TicketView, TicketViewModel> Set, AutoLayoutContentView PremisesBorder)
        {
            var PremisesDirectionsBox = PremisesBorder.AddContainer("PremisesDirectionsBox", UIColor.White);

            PremisesDirectionsBox.AddLabelCenteredX("PremisesDirections", "Directions", UIColor.Blue, 12);
            PremisesDirectionsBox.AddImageCenteredX("PremisesDirectionsImage", "ic_directions.png");
            PremisesDirectionsBox.AddConstraint("V:|[PremisesDirectionsImage(36)]-3-[PremisesDirections]|");
            PremisesDirectionsBox.AddConstraint("H:|-(>=1)-[PremisesDirectionsImage(36)]-(>=1)-|");
            PremisesDirectionsBox.AddConstraint("H:|-(>=1)-[PremisesDirections]-(>=1)-|");
        }
 void SetCustomerAndContact(MvxFluentBindingDescriptionSet<TicketView, TicketViewModel> Set, AutoLayoutContentView ContactBorder)
 {
     var Customer = ContactBorder.AddContainer ("Customer", UIColor.White);
     var SiteContact = ContactBorder.AddContainer ("SiteContact", UIColor.White);
     ContactBorder.AddConstraint ("V:|-[Customer]-25-[SiteContact]|");
     ContactBorder.AddConstraint ("H:|-[Customer]-(>=8)-|");
     ContactBorder.AddConstraint ("H:|-[SiteContact]-(>=8)-|");
     SetCustomer (Set, Customer);
     SetContact (Set, SiteContact);
 }
 void SetCustomer(MvxFluentBindingDescriptionSet<TicketView, TicketViewModel> Set, AutoLayoutContentView Customer)
 {
     Customer.AddLabel ("CustomerLabel", "CUSTOMER", UIColor.LightGray/*TelstraGreyL6*/, TowLabelTextSize);
     var name = Customer.AddLabel ("CustomerName", "Alex Eadie", UIColor.Black, TowDataTextSize);
     var telstra = Customer.AddImage ("Customer_telstra_img", "ic_telstra_logo.png");
     Customer.AddConstraint ("V:|-18-[CustomerLabel]-7-[CustomerName]|");
     Customer.AddConstraint ("V:|-20-[Customer_telstra_img(28)]-(>=8)-|");
     Customer.AddConstraint ("H:|-19-[CustomerLabel]-(>=8)-|");
     Customer.AddConstraint ("H:|-19-[CustomerName]-(>=8)-|");
     Customer.AddConstraint ("H:|-(>=8)-[Customer_telstra_img(28)]-27-|");
     Set.Bind (name).To (vm => vm.Hello);
     Set.Bind (telstra).For ("Visibility").To (vm => vm.Telstra).WithConversion ("Visibility");
 }
 void SetContact(MvxFluentBindingDescriptionSet<TicketView, TicketViewModel> Set, AutoLayoutContentView SiteContact)
 {
     SiteContact.AddLabel ("SiteContactLabel", "SITE CONTACT", UIColor.LightGray/*TelstraGreyL6*/, TowLabelTextSize);
     var name = SiteContact.AddLabel ("SiteContactName", "Natasha Eadie", UIColor.Black, TowDataTextSize);
     var phone = SiteContact.AddLabel ("SiteContactPhone", "0412 123 456", UIColor.Black, TowDataTextSize);
     SiteContact.AddImage ("SitePhoneImage", "ic_phone.png");
     SiteContact.AddConstraint ("V:|[SiteContactLabel]-3-[SiteContactName]-3-[SiteContactPhone]-18-|");
     SiteContact.AddConstraint ("V:|-20-[SitePhoneImage(23)]-(>=8)-|");
     SiteContact.AddConstraint ("H:|-19-[SiteContactLabel]-(>=8)-|");
     SiteContact.AddConstraint ("H:|-19-[SiteContactName]-(>=10)-[SitePhoneImage(23)]-27-|");
     SiteContact.AddConstraint ("H:|-19-[SiteContactPhone]-(>=8)-|");
     Set.Bind (name).To (vm => vm.Hello);
     Set.Bind (phone).To (vm => vm.Hello);
 }
        void SetComponents(MvxFluentBindingDescriptionSet <SimpleExampleView, SimpleExampleViewModel> Set, AutoLayoutContentView ComponentsBorder)
        {
            var button1 = ComponentsBorder.AddButton("Button1", "Scroll Example", UIColor.Green, UIColor.White, 12);

            ComponentsBorder.AddActivityIndicator("ActivityIndicator", UIColor.Blue);
            ComponentsBorder.AddPageControl("PageControl", UIColor.Blue);
            ComponentsBorder.AddProgressView("ProgressView", UIColor.Blue);
            ComponentsBorder.AddSlider("Slider", UIColor.Blue);
            ComponentsBorder.AddSwitch("Switch", UIColor.Blue);
            ComponentsBorder.AddSegmentedControl("SegmentedControl", UIColor.Blue);
            // We can add in other UIViews that don't have their own bespoke Add methods.
            var button2 = (UIButton)ComponentsBorder.AddView("Button2", UIButton.FromType(UIButtonType.RoundedRect));

            button2.SetTitle("List Example", UIControlState.Normal);
            ComponentsBorder.AddConstraint("V:|-[Button1(20)]-[ActivityIndicator(60)]-[PageControl(50)]-[ProgressView(50)]-[Slider]-[Switch]-[SegmentedControl]-|");
            ComponentsBorder.AddConstraint("V:|-[Button2(20)]-(>=8)-|");
            ComponentsBorder.AddConstraint("H:|-[Button1(<=100)]-[Button2(<=100)]-(>=8)-|");

            // TODO: these controls still need some beautification and MVX binding.

            ComponentsBorder.AddConstraint("H:|-[ActivityIndicator(60)]-(>=8)-|");
            ComponentsBorder.AddConstraint("H:|-[PageControl(50)]-(>=8)-|");
            ComponentsBorder.AddConstraint("H:|-[ProgressView(50)]-(>=8)-|");
            ComponentsBorder.AddConstraint("H:|-[Slider(100)]-(>=8)-|");
            ComponentsBorder.AddConstraint("H:|-[Switch]-(>=8)-|");
            ComponentsBorder.AddConstraint("H:|-[SegmentedControl]-(>=8)-|");


            Set.Bind(button1).For("Tap").To(vm => vm.GotoScrollView).WithConversion("CommandParameter", "scrollView");
            Set.Bind(button2).For("Tap").To(vm => vm.GotoListView).WithConversion("CommandParameter", "listView");
        }
        void SetProfile(MvxFluentBindingDescriptionSet <SimpleExampleView, SimpleExampleViewModel> Set, AutoLayoutContentView ProfileBorder)
        {
            var Details = ProfileBorder.AddContainer("Details", UIColor.White);
            var Photo   = ProfileBorder.AddContainer("Photo", UIColor.White);

            ProfileBorder.AddConstraint("V:|-[Details]-|");
            ProfileBorder.AddConstraint("V:|-[Photo]-(>=8)-|");
            ProfileBorder.AddConstraint("H:|-[Details]-(>=8)-[Photo]-|");
            Photo.AddImageCenteredX("Picture", "Alex.jpg");
            Photo.AddConstraint("H:|[Picture(48)]|");
            Photo.AddConstraint("V:|[Picture(64)]|");
            Details.AddLabelLeft("Name", "Alex Eadie", UIColor.Black, 12);
            Details.AddLabelLeft("Phone", "0456 234 154", UIColor.Blue, 12);
            Details.AddLabelLeft("Email", "*****@*****.**", UIColor.Blue, 12);
            Details.AddConstraint("V:|[Name]-[Phone]-[Email]-(>=8)-|");
        }
Пример #26
0
        static void SetPremisesTabs(MvxFluentBindingDescriptionSet <TicketView, TicketViewModel> Set, AutoLayoutContentView PremisesBorder)
        {
            var PremisesTabBox         = PremisesBorder.AddContainer("PremisesTabBox", UIColor.White);
            var ConnectionPillarTabBox = PremisesBorder.AddContainer("ConnectionPillarTabBox", UIColor.LightGray);
            var ExchangeTabBox         = PremisesBorder.AddContainer("ExchangeTabBox", UIColor.LightGray);
            var PremisesLabel          = PremisesTabBox.AddLabelCenteredXY("PremisesTab", "PREMISES", UIColor.Black, 15);

            ConnectionPillarTabBox.AddLabelCenteredXY("ConnectionPillarTab", "P74", UIColor.Blue, 15);
            ExchangeTabBox.AddLabelCenteredXY("ExchangeTab", "PARR", UIColor.Blue, 15);

            Set.Bind(PremisesTabBox).For("Tap").To(vm => vm.TestCommand).WithConversion("CommandParameter", "alex");
            // https://github.com/MvvmCross/MvvmCross/wiki/Value-Converters
            Set.Bind(PremisesTabBox).For(field => field.BackgroundColor).To(vm => vm.PremisesTabBackgroundColor).WithConversion("RGBA");
            Set.Bind(PremisesLabel).For(field => field.TextColor).To(vm => vm.PremisesTabTextColor).WithConversion("RGBA");
            SetPremises(Set, PremisesBorder);
        }
 public static AutoLayoutContentView CreateRoot(string name, UIColor color, string font)
 {
     AutoLayoutContentView root = new AutoLayoutContentView (name, null, color, font);
     root.TranslatesAutoresizingMaskIntoConstraints = true;
     return root;
 }
        //https://developer.apple.com/library/ios/technotes/tn2154/_index.html
        //Pure approach
        public AutoLayoutContentView AddScrollView(string name, UIColor color)
        {
            var scrollView = new UIScrollView ();
            this.Add (scrollView);
            scrollView.Frame = new RectangleF (10, 10, 10, 10);// TODO: Is this still required?
            AutoLayoutContentView contentView = new AutoLayoutContentView (name, color, Font);
            contentView.Frame = new RectangleF (10, 10, 10, 10);// TODO: Is this still required?
            scrollView.Add (contentView);

            // Setup constraints
            scrollView.TranslatesAutoresizingMaskIntoConstraints = false;
            contentView.TranslatesAutoresizingMaskIntoConstraints = false;
            OurConstraints.ViewNames.Add (new NSString ("PrivateScrollView"));
            OurConstraints.Views.Add (scrollView);
            int width = (int)this.Bounds.Size.Width;
            int height = (int)this.Bounds.Size.Height;

            AddConstraint ("H:|[PrivateScrollView(" + width + ")]|");
            AddConstraint ("V:|[PrivateScrollView(>=" + height + ")]|");
            AutoLayoutConstraints ScrollViewConstraints = new AutoLayout.AutoLayoutConstraints ();
            ScrollViewConstraints.ViewNames.Add (new NSString ("PrivateContentView"));
            ScrollViewConstraints.Views.Add (contentView);
            AddConstraint ("H:|[PrivateContentView(" + width + ")]|", scrollView, ScrollViewConstraints);
            AddConstraint ("V:|[PrivateContentView(>=" + height + ")]|", scrollView, ScrollViewConstraints);

            OurConstraints.ViewNames.Add (new NSString (name));
            OurConstraints.Views.Add (contentView);
            contentView.Parent = Parent;
            return contentView;
        }
Пример #29
0
        static void SetPremises(MvxFluentBindingDescriptionSet <TicketView, TicketViewModel> Set, AutoLayoutContentView PremisesBorder)
        {
            var address = PremisesBorder.AddLabel("PremisesAddress", "UNIT 103, 402 DRAYTON-WELLCAMP RD PARRAMATTA", UIColor.Black, 15);

            Set.Bind(address).To(vm => vm.Hello);
            SetPremisesDirections(Set, PremisesBorder);
            PremisesBorder.AddConstraint("V:|[PremisesTabBox(55)]-20-[PremisesAddress(60)]-18-|");
            PremisesBorder.AddConstraint("V:|[ExchangeTabBox(55)]-20-[PremisesAddress(60)]-18-|");
            PremisesBorder.AddConstraint("V:|[ConnectionPillarTabBox(55)]-20-[PremisesAddress(60)]-18-|");
            PremisesBorder.AddConstraint("V:|[PremisesTabBox(55)]-28-[PremisesDirectionsBox]-(>=8)-|");
            PremisesBorder.AddConstraint("H:|[PremisesTabBox]-2-[ConnectionPillarTabBox(==PremisesTabBox)]-2-[ExchangeTabBox(==PremisesTabBox)]|");
            PremisesBorder.AddConstraint("H:|-19-[PremisesAddress(<=200)]-(>=6)-[PremisesDirectionsBox(66)]-10-|");
        }
 public AutoLayoutContentView AddContainer(string name, UIColor color)
 {
     AutoLayoutContentView content = new AutoLayoutContentView (name, this, color, this.Font);
     return content;
 }
 void SetCustomerAndContact(AutoLayoutContentView ContactBorder)
 {
     var Customer = ContactBorder.AddContainer ("Customer", UIColor.White);
     var Contact = ContactBorder.AddContainer ("Contact", UIColor.White);
     ContactBorder.AddConstraint ("V:|-[Customer]-25-[Contact]|");
     ContactBorder.AddConstraint ("H:|-[Customer]-(>=8)-|");
     ContactBorder.AddConstraint ("H:|-[Contact]-(>=8)-|");
     SetCustomer (Customer);
     SetContact (Contact);
 }
Пример #32
0
        void SetContact(MvxFluentBindingDescriptionSet <TicketView, TicketViewModel> Set, AutoLayoutContentView SiteContact)
        {
            SiteContact.AddLabel("SiteContactLabel", "SITE CONTACT", UIColor.LightGray /*TelstraGreyL6*/, TowLabelTextSize);
            var name  = SiteContact.AddLabel("SiteContactName", "Natasha Eadie", UIColor.Black, TowDataTextSize);
            var phone = SiteContact.AddLabel("SiteContactPhone", "0412 123 456", UIColor.Black, TowDataTextSize);

            SiteContact.AddImage("SitePhoneImage", "ic_phone.png");
            SiteContact.AddConstraint("V:|[SiteContactLabel]-3-[SiteContactName]-3-[SiteContactPhone]-18-|");
            SiteContact.AddConstraint("V:|-20-[SitePhoneImage(23)]-(>=8)-|");
            SiteContact.AddConstraint("H:|-19-[SiteContactLabel]-(>=8)-|");
            SiteContact.AddConstraint("H:|-19-[SiteContactName]-(>=10)-[SitePhoneImage(23)]-27-|");
            SiteContact.AddConstraint("H:|-19-[SiteContactPhone]-(>=8)-|");
            Set.Bind(name).To(vm => vm.Hello);
            Set.Bind(phone).To(vm => vm.Hello);
        }
Пример #33
0
        void SetCustomerAndContact(MvxFluentBindingDescriptionSet <TicketView, TicketViewModel> Set, AutoLayoutContentView ContactBorder)
        {
            var Customer    = ContactBorder.AddContainer("Customer", UIColor.White);
            var SiteContact = ContactBorder.AddContainer("SiteContact", UIColor.White);

            ContactBorder.AddConstraint("V:|-[Customer]-25-[SiteContact]|");
            ContactBorder.AddConstraint("H:|-[Customer]-(>=8)-|");
            ContactBorder.AddConstraint("H:|-[SiteContact]-(>=8)-|");
            SetCustomer(Set, Customer);
            SetContact(Set, SiteContact);
        }
Пример #34
0
        void SetCustomer(MvxFluentBindingDescriptionSet <TicketView, TicketViewModel> Set, AutoLayoutContentView Customer)
        {
            Customer.AddLabel("CustomerLabel", "CUSTOMER", UIColor.LightGray /*TelstraGreyL6*/, TowLabelTextSize);
            var name    = Customer.AddLabel("CustomerName", "Alex Eadie", UIColor.Black, TowDataTextSize);
            var telstra = Customer.AddImage("Customer_telstra_img", "ic_telstra_logo.png");

            Customer.AddConstraint("V:|-18-[CustomerLabel]-7-[CustomerName]|");
            Customer.AddConstraint("V:|-20-[Customer_telstra_img(28)]-(>=8)-|");
            Customer.AddConstraint("H:|-19-[CustomerLabel]-(>=8)-|");
            Customer.AddConstraint("H:|-19-[CustomerName]-(>=8)-|");
            Customer.AddConstraint("H:|-(>=8)-[Customer_telstra_img(28)]-27-|");
            Set.Bind(name).To(vm => vm.Hello);
            Set.Bind(telstra).For("Visibility").To(vm => vm.Telstra).WithConversion("Visibility");
        }
 public static AutoLayoutContentView CreateListContentRoot(string name, UIColor color, UIView view, string font)
 {
     AutoLayoutContentView root = new AutoLayoutContentView (name, null, color, font);
     root.TranslatesAutoresizingMaskIntoConstraints = true;
     int width = (int)view.Bounds.Size.Width;
     int height = (int)view.Bounds.Size.Height;
     root.Frame = new RectangleF (0, 0, width, height);
     return root;
 }
Пример #36
0
        public AutoLayoutContentView AddContainer(string name, UIColor color)
        {
            AutoLayoutContentView content = new AutoLayoutContentView(name, this, color, this.Font);

            return(content);
        }