我在WinPhone客户端的Xamarin.Forms应用程序中有奇怪的行为。 我的MainPage是一个NavigationPage。当我导航到第二页并将手机转向横向(也发生在另一侧)时,页面右侧显示一个黑色区域。似乎高度和宽度属性不会在设备方向更改上重新计算。Xamarin.Forms WindowsPhone Landscape NavigationPage显示黑色区域
要重现这一点,只需创建一个新的Xamarin.Forms空白应用程序(Visual Studio 2013模板),将Xamarin.Forms nuget更新到最新的版本(在我的情况下为2.0.0.6490),并将以下内容添加到App-Constructor:
var second = new ContentPage
{
BackgroundColor = Color.Green,
Content = new StackLayout
{
VerticalOptions = LayoutOptions.Center,
Children = {
new Label {
XAlign = TextAlignment.Center,
Text = "Second Page"
}
}
}
};
var button = new Button {Text = "Show Second"};
button.Clicked += async (sender, args) => { await ((NavigationPage) MainPage).PushAsync(second); };
var firstpage = new ContentPage
{
BackgroundColor = Color.Blue,
Content = new StackLayout
{
VerticalOptions = LayoutOptions.Center,
Children = {
new Label {
XAlign = TextAlignment.Center,
Text = "First Page"
},
button
}
}
};
// The root page of your application
MainPage = new NavigationPage(firstpage);
这是Xamarin.Forms中的错误吗?或想念我只是一些东西?在此先感谢
谢谢。我发现了一个报告错误:https://bugzilla.xamarin.com/show_bug.cgi?id = 36477 – Joehl