static Layout CreateCollapseWidthAdjuster(FlyoutPage page) { var adjustCollapseWidthLabel = new Label { Text = "Adjust Collapsed Width", VerticalTextAlignment = TextAlignment.Center, VerticalOptions = LayoutOptions.Center }; var adjustCollapseWidthEntry = new Entry { Text = page.On <WindowsOS>().CollapsedPaneWidth().ToString() }; var adjustCollapseWidthButton = new Button { Text = "Change", BackgroundColor = Color.Gray }; adjustCollapseWidthButton.Clicked += (sender, args) => { double newWidth; if (double.TryParse(adjustCollapseWidthEntry.Text, out newWidth)) { page.On <WindowsOS>().CollapsedPaneWidth(newWidth); } }; var adjustCollapsedWidthSection = new StackLayout { HorizontalOptions = LayoutOptions.Center, Orientation = StackOrientation.Horizontal, Children = { adjustCollapseWidthLabel, adjustCollapseWidthEntry, adjustCollapseWidthButton } }; return(adjustCollapsedWidthSection); }
public void Properties() { var x = new FlyoutPage(); x.On <Android>().SetSomeAndroidThing(42); Assert.IsTrue(x.On <Android>().GetSomeAndroidThing() == 42); }
public void ConsumeVendorSetting() { var x = new FlyoutPage(); x.On <iOS>().SetVendorFoo(false); Assert.IsFalse(x.On <iOS>().GetVendorFoo()); }
public void VendorPlatformProperty() { var x = new FlyoutPage(); Assert.IsTrue(x.On <iOS>().GetVendorFoo()); x.On <iOS>().SetVendorFoo(false); Assert.IsFalse(x.On <iOS>().GetVendorFoo()); }
static Layout CreateCollapseStyleChanger(FlyoutPage page) { Type enumType = typeof(CollapseStyle); return(CreateChanger(enumType, Enum.GetName(enumType, page.On <WindowsOS>().GetCollapseStyle()), picker => { page.On <WindowsOS>().SetCollapseStyle((CollapseStyle)Enum.Parse(enumType, picker.Items[picker.SelectedIndex])); }, "Select Collapse Style")); }
public void ConvenienceConfiguration() { var x = new FlyoutPage(); x.On <Android>().UseTabletDefaults(); Assert.IsTrue(x.On <Android>().GetSomeAndroidThing() == 10); Assert.IsTrue(x.On <Android>().GetSomeOtherAndroidThing() == 45); x.On <Android>().UsePhabletDefaults(); Assert.IsTrue(x.On <Android>().GetSomeAndroidThing() == 8); Assert.IsTrue(x.On <Android>().GetSomeOtherAndroidThing() == 40); }