protected override async void OnAppearing() { base.OnAppearing(); if (_viewModel != null) { await _viewModel.InitAsync(); } WalkEntriesListView.Opacity = 0; await WalkEntriesListView.FadeTo(1, 4000); // crazy animation. annoying but is a good example //var parentAnimation = new Animation(); //var ZoomInAnimation = new Animation(v => LoadingWalkInfo.Scale = v, 1, 2, Easing.BounceIn, null); //parentAnimation.Add(0, 0.5, ZoomInAnimation); //var ZoomOutAnimation = new Animation(v => LoadingWalkInfo.Scale = v, 2, 1, Easing.BounceOut, null); //parentAnimation.Insert(0.5, 1, ZoomOutAnimation); //parentAnimation.Commit(this, "CustomAnimation", 16, 5000, null, null); WalkEntriesListView.SetBinding(ItemsView <Cell> .ItemsSourceProperty, new Binding(".")); WalkEntriesListView.BindingContext = _viewModel.WalksListModel; }
// Method to initialise our View Model when the ContentPage appears protected override async void OnAppearing() { base.OnAppearing(); if (_viewModel != null) { // Call the Init method to initialise the ViewModel await _viewModel.Init(); } // Set up and initialise the binding for our ListView WalkEntriesListView.SetBinding(ItemsView <Cell> .ItemsSourceProperty, new Binding(".")); WalkEntriesListView.BindingContext = _viewModel.WalksListModel; }
// Method to initialise our View Model when the ContentPage appears protected override async void OnAppearing() { base.OnAppearing(); if (_viewModel != null) { // Call the Init method to initialise the ViewModel await _viewModel.Init(); if (!TwitterAuthDetails.isLoggedIn) { // We need to Navigate and display our Twitter Sign In Page await _viewModel.Navigation.NavigateTo <TwitterSignInPageViewModel>(); } } //chap 09 // Create a FadingEntrance Animation to fade our WalkEntriesListView WalkEntriesListView.Opacity = 0; await WalkEntriesListView.FadeTo(1, 4000); // Create a Custom Animation for our LoadingWalkInfo Label // Create parent animation object var parentAnimation = new Animation(); // Create "ZoomIn" animation and add to parent. var ZoomInAnimation = new Animation(v => LoadingWalkInfo.Scale = v, 1, 2, Easing.BounceIn, null); parentAnimation.Add(0, 0.5, ZoomInAnimation); // Create "ZoomOut" animation and add to parent. var ZoomOutAnimation = new Animation(v => LoadingWalkInfo.Scale = v, 2, 1, Easing.BounceOut, null); parentAnimation.Insert(0.5, 1, ZoomOutAnimation); // Commit parent animation parentAnimation.Commit(this, "CustomAnimation", 16, 5000, null, null); // end chap 09 // Set up and initialise the binding for our ListView WalkEntriesListView.SetBinding(ItemsView <Cell> .ItemsSourceProperty, new Binding(".")); WalkEntriesListView.BindingContext = _viewModel.WalksListModel; }