예제 #1
0
        void CreateLayout()
        {
            NameLabel = new TLabelView();
            ContentView.Add(NameLabel);

            CheckBox = new TCheckbox();
            ContentView.Add(CheckBox);

            ContentView.AddConstraints(new FluentLayout[] {
                NameLabel.WithSameCenterY(ContentView),
                NameLabel.AtLeftOf(ContentView),

                CheckBox.WithSameCenterY(ContentView),
                CheckBox.AtRightOf(ContentView),
            });
        }
예제 #2
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            var bindingSet = this.CreateBindingSet <ExceptionModalView, ModalViewModel>();

            bindingSet = BindLoader(bindingSet);

            var exceptionDetails = new TLabelView();

            Add(exceptionDetails);

            bindingSet.Bind(exceptionDetails).To(vm => vm.Exception).Apply();

            var closeButton = new UIButton(UIButtonType.Custom);

            closeButton.SetImage(UIImage.FromBundle("Images/close.png"), UIControlState.Normal);
            closeButton.Frame = new RectangleF(0, 0, 30, 30);
            NavigationItem.SetLeftBarButtonItems(new UIBarButtonItem[] {
                new UIBarButtonItem(UIBarButtonSystemItem.FixedSpace, null, null)
                {
                    Width = -5f
                },
                new UIBarButtonItem(closeButton)
            }, false);

            bindingSet.Bind(closeButton)
            .For("TouchUpInside")
            .To(vm => vm.CloseCommand).Apply();

            View.AddConstraints(new FluentLayout[] {
                exceptionDetails.AtTopOf(View, Constants.MARGIN),
                exceptionDetails.AtLeftOf(View, Constants.MARGIN),
                exceptionDetails.WithSameWidth(View).Minus(Constants.MARGIN * 2)
            });
        }