Example #1
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            // Perform any additional setup after loading the view
            var contentLayout = new LinearLayout(Orientation.Vertical)
            {
                LayoutParameters = new LayoutParameters(AutoSize.FillParent, AutoSize.FillParent)
                {
                },
                SubViews = new View[]
                {
                    new LinearLayout(Orientation.Vertical)
                    {
                        Layer = new CoreAnimation.CALayer
                        {
                            BackgroundColor = UIColor.Gray.CGColor,
                            CornerRadius    = 20,
                            BorderColor     = UIColor.Red.CGColor,
                            BorderWidth     = 4
                        },
                        LayoutParameters = new LayoutParameters(AutoSize.FillParent, 50)
                        {
                            Margins = new UIEdgeInsets(20, 20, 20, 20),
                        },
                        SubViews = new View[]
                        {
                            new NativeView
                            {
                                View             = new UIButton(),
                                LayoutParameters = new LayoutParameters(AutoSize.FillParent, 20),
                                Init             = view =>
                                {
                                    var button = view.As <UIButton>();
                                    button.SetTitle("test button", UIControlState.Normal);
                                    button.BackgroundColor = UIColor.Green;
                                }
                            }
                        }
                    }
                }
            };

            View = new UILayoutHost(contentLayout)
            {
                BackgroundColor = UIColor.White
            };
            //View = new UIView(new CoreGraphics.CGRect(100, 100, 200, 200)) {BackgroundColor=UIColor.Purple };
        }
Example #2
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            // Perform any additional setup after loading the view

            var contentLayout = new LinearLayout(Orientation.Horizontal)
            {
                LayoutParameters = new LayoutParameters(AutoSize.WrapContent, AutoSize.FillParent)
            };

            View = new UILayoutHost(contentLayout)
            {
                BackgroundColor = UIColor.White
            };
        }