I have a search page that have a Button to navigate to another page . When I click on that Button it takes about 4 seconds to navigate .
SearchPage Command :
Device.BeginInvokeOnMainThread(async () =>
{
await (Application.Current.MainPage as NavigationPage).PushAsync(new OtherPage());
});
OtherPage Code Behind :
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class OtherPage : ContentPage
{
SearchStateViewModel Model;
public SearchEstatePage()
{
InitializeComponent();
Model = new SearchStateViewModel();
Layout.BindingContext = Model;
}
protected override void OnAppearing()
{
base.OnAppearing();
Model.GetCities();
}
}
What is the problem ?
GetCitiesand tested it also why are you usingBeginInvokeOnMainThread? - TheGeneralGetCitiesand deleteBeginInvokeOnMainThreadfor the first time it takes 3 seconds and when i press back button and again press navigation button it navigate fast . only first time is slow - mm sh