本文整理汇总了C#中ContentPage.Layout方法的典型用法代码示例。如果您正苦于以下问题:C# ContentPage.Layout方法的具体用法?C# ContentPage.Layout怎么用?C# ContentPage.Layout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ContentPage
的用法示例。
在下文中一共展示了ContentPage.Layout方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestChildFillBehavior
public void TestChildFillBehavior ()
{
var child = new Label ();
Page root = new ContentPage {Content = child};
root.IsPlatformEnabled = child.IsPlatformEnabled = true;
root.Layout (new Rectangle (0, 0, 200, 500));
Assert.AreEqual (child.Width, 200);
Assert.AreEqual (child.Height, 500);
}
示例2: TestSizedChildBehavior
public void TestSizedChildBehavior ()
{
var plat = new UnitPlatform ();
var child = new Label {Platform = plat, IsPlatformEnabled = true, WidthRequest = 100, HorizontalOptions = LayoutOptions.Center};
var root = new ContentPage {Platform = plat, IsPlatformEnabled = true, Content = child};
root.Layout (new Rectangle (0, 0, 200, 500));
Assert.AreEqual (50, child.X);
Assert.AreEqual (100, child.Width);
Assert.AreEqual (500, child.Height);
child = new Label () {
Platform = plat, IsPlatformEnabled = true,
HeightRequest = 100,
VerticalOptions = LayoutOptions.Center
};
root = new ContentPage {
Platform = plat, IsPlatformEnabled = true,
Content = child
};
root.Layout (new Rectangle (0, 0, 200, 500));
Assert.AreEqual (0, child.X);
Assert.AreEqual (200, child.Y);
Assert.AreEqual (200, child.Width);
Assert.AreEqual (100, child.Height);
child = new Label ();
child.IsPlatformEnabled = true;
child.HeightRequest = 100;
root = new ContentPage {
Content = child,
Platform = plat, IsPlatformEnabled = true
};
root.Layout (new Rectangle (0, 0, 200, 500));
Assert.AreEqual (0, child.X);
Assert.AreEqual (0, child.Y);
Assert.AreEqual (200, child.Width);
Assert.AreEqual (500, child.Height);
}
示例3: TestLayoutWithContainerArea
public void TestLayoutWithContainerArea ()
{
View child;
var page = new ContentPage {
Content = child = new View {
WidthRequest = 100,
HeightRequest = 200,
IsPlatformEnabled = true
},
IsPlatformEnabled = true,
Platform = new UnitPlatform ()
};
page.Layout (new Rectangle (0, 0, 800, 800));
Assert.AreEqual (new Rectangle (0, 0, 800, 800), child.Bounds);
page.ContainerArea = new Rectangle (10, 10, 30, 30);
Assert.AreEqual (new Rectangle (10, 10, 30, 30), child.Bounds);
page.Layout (new Rectangle (0, 0, 50, 50));
Assert.AreEqual (new Rectangle (10, 10, 30, 30), child.Bounds);
}
示例4: TestLayoutChildrenCenter
public void TestLayoutChildrenCenter ()
{
View child;
var page = new ContentPage {
Content = child = new View {
WidthRequest = 100,
HeightRequest = 200,
HorizontalOptions = LayoutOptions.Center,
VerticalOptions = LayoutOptions.Center,
IsPlatformEnabled = true
},
IsPlatformEnabled = true,
Platform = new UnitPlatform ()
};
page.Layout (new Rectangle (0, 0, 800, 800));
Assert.AreEqual (new Rectangle (350, 300, 100, 200), child.Bounds);
page.Layout (new Rectangle (0, 0, 50, 50));
Assert.AreEqual (new Rectangle (0, 0, 50, 50), child.Bounds);
}