protected override void OnElementChanged(ElementChangedEventArgs <CarouselPage> e) { base.OnElementChanged(e); _pagedCarouselPage = (CxPagedCarouselPage)Element; _viewPager = null; for (int i = 0; i < ViewGroup.ChildCount; i++) { _viewPager = ViewGroup.GetChildAt(i) as ViewPager; if (_viewPager != null) { break; } } if (_viewPager == null) { return; } var density = Resources.DisplayMetrics.Density; _circlePageIndicator = new CirclePageIndicator(base.Context); _circlePageIndicator.SetPadding(5, 5, 5, 5); _circlePageIndicator.Radius = 5 * density; SetPageIndicatorTintColor(); SetCurrentPageIndicatorTintColor(); AddView(_circlePageIndicator); _circlePageIndicator.BringToFront(); }
protected override void OnElementChanged (ElementChangedEventArgs<CarouselPage> e) { base.OnElementChanged (e); _pagedCarouselPage = (CustomCarouselPage)Element; _viewPager = null; for (int i = 0; i < ViewGroup.ChildCount; i++) { _viewPager = ViewGroup.GetChildAt (i) as ViewPager; if (_viewPager != null) break; } if (_viewPager == null) return; var density = Resources.DisplayMetrics.Density; _circlePageIndicator = new CirclePageIndicator (base.Context); _circlePageIndicator.SetPadding (5, 5, 5, 5); _circlePageIndicator.Radius = 5 * density; _circlePageIndicator.PageSelected += (object sender, PageSelectedEventArgs args) => { if(Element.ItemsSource == null) return; int count = 0; foreach (var item in Element.ItemsSource) { if (count == args.Position) { Element.SelectedItem = item; break; } count++; } }; SetPageIndicatorTintColor (); SetCurrentPageIndicatorTintColor (); AddView (_circlePageIndicator); _circlePageIndicator.BringToFront (); }
protected override void OnElementChanged(ElementChangedEventArgs<CarouselPage> e) { base.OnElementChanged(e); _pagedCarouselPage = (CxPagedCarouselPage) Element; _viewPager = null; for (int i = 0; i < ViewGroup.ChildCount; i++) { _viewPager = ViewGroup.GetChildAt(i) as ViewPager; if (_viewPager != null) break; } if (_viewPager == null) return; var density = Resources.DisplayMetrics.Density; _circlePageIndicator = new CirclePageIndicator(base.Context); _circlePageIndicator.SetPadding(5, 5, 5, 5); _circlePageIndicator.Radius = 5*density; SetPageIndicatorTintColor(); SetCurrentPageIndicatorTintColor(); AddView(_circlePageIndicator); _circlePageIndicator.BringToFront(); }