private void SetupBox3(ExtendedCarouselView box) { Label lb1 = new Label { TextColor = Color.Black, Text = ExampleStrings.LiveTile3[0] }; Label lb2 = new Label { TextColor = Color.White, Text = ExampleStrings.LiveTile3[1] }; ContentView pg1 = new ContentView { Padding = new Thickness(5), BackgroundColor = Color.FromHex("#92E9DC"), Content = lb1 }; ContentView pg2 = new ContentView { Padding = new Thickness(5), BackgroundColor = Color.FromHex("#399A8C"), Content = lb2 }; box.Pages.Add(pg1); box.Pages.Add(pg2); box.Initialise(0); }
private void SetupBox4(ExtendedCarouselView box) { int timesTileHasChanged = 0; Label lb1 = new Label { TextColor = Color.White, FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)), Text = ExampleStrings.LiveTile4[0] }; Label lb2 = new Label { TextColor = Color.White, FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)), Text = ExampleStrings.LiveTile4[0] + "\n\n" + ExampleStrings.LiveTile4[1] }; CarouselPage pg1 = new CarouselPage { Padding = new Thickness(5), BackgroundColor = Color.FromHex("#FF7C2E"), Content = lb1, }; CarouselPage pg2 = new CarouselPage { Padding = new Thickness(5), BackgroundColor = Color.FromHex("#8C3500"), Content = lb2 }; // If you extend the standard layout classes to implement the ICarouselView interface // Then you can tie events to when the pages change. pg1.PageAppearing += () => { Device.BeginInvokeOnMainThread(() => { lb1.Text = String.Format("{0} {1}", ExampleStrings.LiveTile4[0], ++timesTileHasChanged); }); }; pg2.PageAppearing += () => { Device.BeginInvokeOnMainThread(() => { lb2.Text = String.Format("{0} {1}\n\n{2}", ExampleStrings.LiveTile4[0], ++timesTileHasChanged, ExampleStrings.LiveTile4[1]); }); }; box.Pages.Add(pg1); box.Pages.Add(pg2); box.Initialise(0); }
private View GenerateLayout() { double margin = Device.RuntimePlatform == Device.iOS ? 5 : (Device.RuntimePlatform == Device.Android ? 5 : 5); _baseLayout = new Grid() { ColumnDefinitions = new ColumnDefinitionCollection { new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) } }, RowDefinitions = new RowDefinitionCollection { new RowDefinition { Height = new GridLength(_dimensions.Value.X / 2, GridUnitType.Absolute) }, new RowDefinition { Height = new GridLength(_dimensions.Value.X / 2, GridUnitType.Absolute) }, new RowDefinition { Height = new GridLength(_dimensions.Value.X / 2, GridUnitType.Absolute) }, new RowDefinition { Height = new GridLength(_dimensions.Value.X / 2, GridUnitType.Absolute) } }, Margin = new Thickness(margin) }; box1 = new ExtendedCarouselView { Pages = new List <Layout>() }; // LiveTile box2 = new ContentView { BackgroundColor = Color.Green }; // Boring Tile box3 = new ExtendedCarouselView { Pages = new List <Layout>() }; // Double-Width Live-Tile box4 = new ExtendedCarouselView { Pages = new List <Layout>() }; // Double-Height Live-Tile box5 = new ContentView { BackgroundColor = Color.Blue }; // Double-Height boring tile SetupBox1(box1); SetupBox2(box2); SetupBox3(box3); SetupBox4(box4); SetupBox5(box5); _baseLayout.Children.Add(box1, 0, 1, 0, 1); _baseLayout.Children.Add(box2, 1, 2, 0, 1); _baseLayout.Children.Add(box3, 0, 2, 1, 2); _baseLayout.Children.Add(box4, 0, 1, 2, 4); _baseLayout.Children.Add(box5, 1, 2, 2, 4); return(new ScrollView { Orientation = ScrollOrientation.Vertical, Content = _baseLayout, }); }