Reputation: 4173
On Xamarin.Forms Project, I am trying to tellActivityIndicator
to show yourself and then navigate to another page
activityIndicatorObject = new ActivityIndicator()
{
HorizontalOptions = LayoutOptions.CenterAndExpand,
Color = Color.Red,
IsVisible = false,
IsRunning = false,
IsEnabled = false,
BindingContext = this,
};
ViewBookButton = new Button{ Text = "view book" };
ViewBookButton.Clicked += ViewBook;
protected void ViewBook(Object sender,EventArgs e)
{
//Go To View Book Page
activityIndicatorObject .IsVisible = true;
activityIndicatorObject .IsRunning = true;
activityIndicatorObject .IsEnabled = true;
activityIndicatorObject .SetBinding(ActivityIndicator.IsVisibleProperty, "IsBusy");
this.IsBusy = true;
Navigation.PushAsync(new BookPage());
this.IsBusy = false;
}
ActivityIndicator
doesn't showing? How I can make it showing?
Upvotes: 2
Views: 2501
Reputation: 3388
As I understand you tell ActivityIndicator
show yourself and then navigate to another page. And new page hasn't own ActivityIndicator
. I would like to suggest you make your hard operations in OnAppearing
method of BookPage
.
protected override void OnAppearing()
{
base.OnAppearing();
activityIndicator.IsVisible = true;
// Some hard operations
activityIndicator.IsVisible = false;
}
Or use binding instead of activityIndicator.IsVisible = true;
Upvotes: 6