我在xamarin.forms中有shared app
使用
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection.Emit;
using System.Text;
using Xamarin.Forms;
namespace MyFin1.Views.Reports
{
public class Reports_view : ContentPage
{
StackLayout Lay = new StackLayout();
public Reports_view ()
{
NavigationPage.SetHasNavigationBar(this, true);
Lay.Children.Add(
new Xamarin.Forms.Label
{
Text = "Мои Финансы",
TextColor = Color.FromRgb(200, 200, 200),
HorizontalOptions = LayoutOptions.FillAndExpand,
VerticalOptions = LayoutOptions.Center,
FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Xamarin.Forms.Label)),
FontAttributes = FontAttributes.Bold | FontAttributes.Italic,
BackgroundColor=Color.Aqua
}
);
Button Bar_chart_go = new Button
{
Text = "Динамика",
BackgroundColor = Color.Red,
HorizontalOptions = LayoutOptions.FillAndExpand
};
Button Pie_chart_go = new Button
{
Text = "Структура",
BackgroundColor = Color.Green,
HorizontalOptions = LayoutOptions.FillAndExpand
};
Bar_chart_go.Clicked += Bar_chart_go_Clicked;
Pie_chart_go.Clicked += Pie_chart_go_Clicked;
Lay.Children.Add(Bar_chart_go);
Lay.Children.Add(Pie_chart_go);
Content = new StackLayout {
BackgroundColor=Color.Maroon,
HorizontalOptions = LayoutOptions.FillAndExpand,
Children = {
Lay
}
};
}
}在Android模拟器上,所有功能都工作正常(旋转屏幕时-视图旋转时)


在Windows Phone (诺基亚530)上有以下问题:


在MainPage.xaml.cs中,我有SupportedOrientations = SupportedPageOrientation.PortraitOrLandscape;
如果我旋转,然后导航到页面,所有工作都很好。

有办法解决这个问题吗?
其他信息
Xamarin.Forms 2.0.1.6505
关于RU_SO的PS原始问题
发布于 2016-03-23 02:12:45
也许这能有所帮助:
在你的构造函数中:
this.SizeChanged += ModalPage_SizeChanged;然后:
void ModalPage_SizeChanged (object sender, EventArgs e)
{
this.WidthRequest = Width;
this.HeightRequest = Height;
Lay.WidthRequest = Width;
Lay.HeightRequest = Height;
}https://stackoverflow.com/questions/36156694
复制相似问题