Esempio n. 1
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            View.BackgroundColor = UIColor.Clear;

            _imgBackground = new UIImageView(UIImage.FromBundle("Background.jpg"))
            {
                ContentMode = UIViewContentMode.ScaleAspectFill
            };

            Title = Strings.Statistics;

            _btnClose = new UIBarButtonItem(UIBarButtonSystemItem.Cancel);
            NavigationItem.SetLeftBarButtonItem(_btnClose, false);

            _lblTitle = new UILabel
            {
                Font      = UIFont.SystemFontOfSize(28f, UIFontWeight.Bold),
                TextColor = AppColors.AccentColor.ToNativeColor(),
                Text      = Strings.DeathStarStatus
            };

            _plotView = new PlotView();
            _plotView.BackgroundColor = UIColor.Clear;

            View.AddSubviews(_imgBackground, _lblTitle, _plotView);
            View.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();

            View.AddConstraints(
                _imgBackground.AtLeftOf(View),
                _imgBackground.AtTopOf(View),
                _imgBackground.AtBottomOf(View),
                _imgBackground.AtRightOf(View),

                _lblTitle.AtLeftOf(View, 12f),
                _lblTitle.AtTopOf(View, 8f),
                _lblTitle.AtRightOf(View, 12f),

                _plotView.Below(_lblTitle),
                _plotView.AtLeftOf(View),
                _plotView.AtRightOf(View),
                _plotView.AtBottomOf(View)
                );

            View.BringSubviewToFront(_plotView);

            var set = this.CreateBindingSet <StatusView, StatusViewModel>();

            set.Bind(_plotView).For(v => v.Model).To(vm => vm.PlotModel);
            set.Bind(_btnClose).For("Clicked").To(vm => vm.CloseCommand);
            set.Apply();
        }