Hi All,
i have discovered a very strange problem or behavior of xamarin.forms for me. The problem is navigation only works in debug or release mode, as soon as I create an APK (archive) navigation doesn't work anymore. I cut my code down to a minimun (only looks big by the CommandCanExecute part) I have no idea why this run fine in debug and release mode but if its packed up it wont, i don't even get an exception thrown
// App
public App() {
InitializeComponent();
MainPage = new NavigationPage(new Views.MainPage());
}
// MainPage
public partial class MainPage : ContentPage {
MainPageViewModel viewModel;
public MainPage() {
InitializeComponent();
viewModel = new MainPageViewModel(this, Navigation, ScrollViewLog);
BindingContext = viewModel;
}
}
// MainPageViewModel
public class MainPageViewModel : INotifyPropertyChanged {
// property
private bool openOptionsPasswordCheckCommandCanExecute = true;
public bool OpenOptionsPasswordCheckCommandCanExecute {
get { return openOptionsPasswordCheckCommandCanExecute; }
set {
openOptionsPasswordCheckCommandCanExecute = value;
((Command)OpenOptionsPasswordCheckCommand).ChangeCanExecute();
}
}
// command
public ICommand OpenOptionsPasswordCheckCommand { get; private set; }
// fields
private INavigation navigation;
// construct
public MainPageViewModel(INavigation navigation) {
this.navigation = navigation;
OpenOptionsPasswordCheckCommand = new Command(async () => await OpenOptionsPasswordCheckCommandAction(), () => OpenOptionsPasswordCheckCommandCanExecute);
}
// the navigation
private async Task OpenOptionsPasswordCheckCommandAction() => await NavigateToOptionsCheckPassword();
public async Task NavigateToOptionsCheckPassword() => await navigation.PushAsync(new OptionsPasswordCheck());
// even if I not use the passed Navigation object it won't work -->
// Application.Current.MainPage.Navigation.PushAsync(new OptionsPasswordCheck()); // navigation.PushAsync(new OptionsPasswordCheck()
}