public override void Run(Box parent) { var carouselView = new Ext.CarouselView(parent) { WeightX = 1, WeightY = 1, AlignmentY = -1, AlignmentX = -1, }; carouselView.Show(); var items = new List <string>(); for (int i = 0; i < 10; i++) { items.Add($"Items {i}"); } var adaptor = new MyAdaptor(items); carouselView.Adaptor = adaptor; carouselView.LayoutManager = new Ext.LinearLayoutManager(true, Ext.ItemSizingStrategy.MeasureFirstItem, 10); parent.PackEnd(carouselView); }
public override void Run(Box parent) { var carouselView = new Ext.CarouselView(parent) { WeightX = 1, WeightY = 1, AlignmentY = -1, AlignmentX = -1, }; carouselView.Show(); var items = new List <string>(); for (int i = 0; i < 10; i++) { items.Add($"Items {i}"); } var adaptor = new MyAdaptor(items); carouselView.Adaptor = adaptor; carouselView.LayoutManager = new Ext.LinearLayoutManager(false, Ext.ItemSizingStrategy.MeasureFirstItem, 10); var indicatorView = new Ext.IndicatorView(parent) { WeightX = 1, WeightY = 0.05, AlignmentY = -1, AlignmentX = -1, }; indicatorView.Show(); indicatorView.ClearIndex(); indicatorView.AppendIndex(items.Count); indicatorView.Update(0); var flag1 = false; var flag2 = false; indicatorView.SelectedPosition += (s, e) => { if (!flag2) { flag1 = true; carouselView.ScrollTo(e.SelectedPosition); flag1 = false; } }; carouselView.Scrolled += (s, e) => { if (!flag1) { flag2 = true; indicatorView.UpdateSelectedIndex(e.CenterItemIndex); flag2 = false; } }; parent.PackEnd(carouselView); parent.PackEnd(indicatorView); }