I have a page with a list of items and when some is selected, the ActivityIndicator turns on and goes to another page, turning off. When i am in this new page and i click the BackButton on NavigationPage, i return to the page with the List of items, but the problem is that the ActivityIndicator is on (persists). How can i fix it ?
[List Page]
public partial class ResultadosBuscados : ContentPage
{
public ResultadosBuscados(IEnumerable dadosPesquisados)
{
IsBusy = false;
InitializeComponent();
BindingContext = this;
ListaBuscados.ItemsSource = dadosPesquisados;
}
public void OnItemSelected(object sender, SelectedItemChangedEventArgs e)
{
IsBusy = true;
stackActivity.IsVisible = true;
Envolvido envolvSelec = (Envolvido)e.SelectedItem;
if (envolvSelec == null)
return;
IsBusy = false;
stackActivity.IsVisible = false;
this.Navigation.PushAsync(new EnvolvidoDetalhe(envolvSelec));
this.ListaBuscados.SelectedItem = null;
}
}
[part of XAML code]
<StackLayout x:Name="stackActivity" IsVisible="False" Padding="12"
AbsoluteLayout.LayoutFlags="PositionProportional"
AbsoluteLayout.LayoutBounds="0.5,0.5,-1,-1">
<Frame Padding="50" OutlineColor="Black" HasShadow="true" AbsoluteLayout.LayoutFlags="PositionProportional" Opacity="0.8" BackgroundColor="Black" VerticalOptions="CenterAndExpand" HorizontalOptions="CenterAndExpand">
<StackLayout>
<ActivityIndicator IsRunning="{Binding IsBusy}" Color ="#F4B400"/>
<Label Text="Aguarde..." TextColor="#F4B400"/>
</StackLayout>
</Frame>
</StackLayout>