我在shared app
xamarin.forms
带
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
PS原始问题RU_SO
答案 0 :(得分:0)
也许这会有所帮助:
在构造函数中:
this.SizeChanged += ModalPage_SizeChanged;
然后:
void ModalPage_SizeChanged (object sender, EventArgs e)
{
this.WidthRequest = Width;
this.HeightRequest = Height;
Lay.WidthRequest = Width;
Lay.HeightRequest = Height;
}