Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 91519

ActivityIndicator does not show from the async function

$
0
0

I am trying to display an activity indication on button click. When I click the button the indicator does
not show: Please Help Thanks...

I am creating the activity indicator as shown below:

var activityIndicator = new ActivityIndicator
{
Color = Color.White
};
activityIndicator.SetBinding(ActivityIndicator.IsRunningProperty, "IsBusy");

var activityIndicatorBackground = new BoxView
{
Color = Color.FromRgba(0, 0, 0, 0.25)
};
activityIndicatorBackground.SetBinding(IsVisibleProperty, "IsBusy");

The button is bound to :

_homeImprovButton.SetBinding(Button.CommandProperty, "EviStatisticTappedCommand");

public Command EviStatisticTappedCommand
{
get
{

        return _eviStatisticTappedCommand ??
               (_eviStatisticTappedCommand = new Command<Type>(
                   async eviStatisticsPageType => await SubmitAsync(eviStatisticsPageType)));
    }

}

private async Task SubmitAsync(Type eviStatisticPageType)
{

    Device.BeginInvokeOnMainThread(() =>
    {
        IsBusy = true;
    });
    await Navigation.PushAsync<EviCarouselViewModel>(
       (viewModel, page) =>
       {
                 var carouselPage = (CarouselPage)page;
                 carouselPage.CurrentPage =
                    carouselPage.Children.Single(
                      childPage => childPage.GetType() == eviStatisticsPageType);

       },
       false);
}

public bool IsBusy
{
get { return _isBusy; }
set { SetProperty(ref _isBusy, value); }
}


Viewing all articles
Browse latest Browse all 91519

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>