public Example_NestedCarousels() { #region Carousel Code // Initialise a new Carousel layout _carousel = new ManualCarouselView { Pages = new List<Layout> (), HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand }; var nestedCarousel = GenerateCarousel(); // Generate our Nested Carousel AddPageToParentCarousel(_carousel, nestedCarousel); // Add the generated _carousel.Pages.Add (CreatePage (Color.Maroon, Color.White, new Label() { Text = "Parent Carousel\nPage 2:\n" + ExampleStrings.ILikeDogs, TextColor = Color.White }, _carousel)); // Finally initialise it, this sets the starting page and calculates the size, etc. _carousel.Initialise (0); #endregion Title = "Nested Carousels"; // Finally, assign the carousel as the page content. Content = _carousel; }
public Example_FullPage() { #region Carousel Code // Initialise a new Carousel layout _carousel = new ManualCarouselView { Pages = new List<Layout> (), HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand }; AddPagesToCarousel (_carousel); // Finally initialise it, this sets the starting page and calculates the size, etc. _carousel.Initialise (0); #endregion // Set the page title Title = "Full Page Carousel"; // Finally, assign the carousel as the page content. Content = _carousel; }
private void SetupBox4(ManualCarouselView box) { int timesTileHasChanged = 0; Label lb1 = new Label { TextColor = Color.White, FontSize = Device.GetNamedSize (NamedSize.Large, typeof(Label)), Text = ExampleStrings.LiveTile4[0] }; Label lb2 = new Label { TextColor = Color.White, FontSize = Device.GetNamedSize (NamedSize.Large, 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 IManualCarouselPage 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 void SetupBox3(ManualCarouselView 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); }
public ManualCarouselView GenerateCarousel() { ManualCarouselView carousel = new ManualCarouselView { Pages = new List<Layout> (), HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand }; AddPagesToCarousel(carousel); carousel.Initialise (0); return carousel; }