Example #1
0
        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 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);
        }