protected override void ConnectHandler(UICollectionView nativeView) { base.ConnectHandler(nativeView); PositionalViewSelector = new PositionalViewSelector(VirtualView); dataSource = new CvDataSource(this); dataSource.IsSelectedHandler = (realSection, realIndex) => VirtualView?.IsItemSelected(realSection, realIndex) ?? false; cvdelegate = new CvDelegate(this); //cvdelegate.ScrollHandler = (x, y) => // VirtualView?.RaiseScrolled(new ScrolledEventArgs(x, y)); collectionView.AllowsSelection = VirtualView.SelectionMode != SelectionMode.None; collectionView.AllowsMultipleSelection = VirtualView.SelectionMode == SelectionMode.Multiple; collectionView.DataSource = dataSource; collectionView.ContentInset = new UIEdgeInsets(0, 0, 0, 0); collectionView.Delegate = cvdelegate; collectionView.ReloadData(); }
protected override void ConnectHandler(RecyclerView nativeView) { layoutManager = new LinearLayoutManager(Context); //layoutManager.Orientation = LinearLayoutManager.Horizontal; positionalViewSelector = new PositionalViewSelector(VirtualView); adapter = new RvAdapter(Context, this, positionalViewSelector); recyclerView.AddOnScrollListener(new RvScrollListener((rv, dx, dy) => { //var x = Context.FromPixels(dx); //var y = Context.FromPixels(dy); // TODO: Proxy up to event // VirtualView?.RaiseScrolled((x, y)); })); recyclerView.SetLayoutManager(layoutManager); recyclerView.SetAdapter(adapter); recyclerView.LayoutParameters = new ViewGroup.LayoutParams( ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent); }
internal RvAdapter(Context context, VirtualListViewHandler handler, PositionalViewSelector positionalViewSelector) { Context = context; this.handler = handler; this.positionalViewSelector = positionalViewSelector; }
public IrSource(IMauiContext context, PositionalViewSelector positionalViewSelector, IVirtualListView virtualListView) { Context = context; PositionalViewSelector = positionalViewSelector; VirtualListView = virtualListView; }