0
我有一個應用程序,其特點是當您打開應用程序時啓動登錄頁面。一旦進入主頁面,它就會有一個主 - 細節頁面來顯示數據。問題是奇怪的佈局。導航頁面位於主頁面的頂部。就像這樣:Xamarin.forms - 登錄頁面導航到主詳細信息頁面有一個奇怪的佈局
這裏是登錄
public partial class LoginPage : ContentPage
{
public LoginPage()
{
InitializeComponent();
}
async void OnSignUpButtonClicked (object sender, EventArgs e)
{
await Navigation.PushAsync (new SignUpPage());
}
async void OnLoginButtonClicked (object sender, EventArgs e)
{
var user = new User {
Username = usernameEntry.Text,
Password = passwordEntry.Text
};
var isValid = AreCredentialsCorrect (user);
if (isValid) {
App.IsUserLoggedIn = true;
Navigation.InsertPageBefore (new MainPage(), this);
await Navigation.PopToRootAsync();
} else {
messageLabel.Text = "Login failed";
passwordEntry.Text = string.Empty;
}
}
bool AreCredentialsCorrect (User user)
{
return user.Username == Constants.Username && user.Password == Constants.Password;
}
}
THANK YOU!我是找到一個簡單的解決方案,像指揮它,而不是添加導航。有用。 –