Example #1
0
        public SecondPage(Page1ViewModel vm, ILogger logger)
        {
            BindingContext = vm;

            Title = "Page 2";

            var welcomeButton = new Button {
                Text              = vm.Message,
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
            };

            //this is OK, but it even better would be to have a command on the view model
            welcomeButton.Clicked += (sender, e) => vm.Navigation.PushAsync <ThirdPage> ();

            Content = welcomeButton;
        }
Example #2
0
        public ThirdPage(Page1ViewModel vm, ILogger logger)
        {
            BindingContext = vm;

            Title = "Page 3";

            var welcomeButton = new Button {
                Text              = vm.Message,
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
            };

            //this is OK, but it even better would be to have a command on the view model
            welcomeButton.Clicked += (sender, e) =>
                                     vm.Navigation.DisplayAlert("message box title", "message box message", "ok");

            Content = welcomeButton;
        }