Skip to content

Geeksltd/Zebble.RecyclerView

Repository files navigation

Zebble.RecyclerView

logo

A high-performance Zebble plugin for providing a list like view for large datasets.

NuGet


Setup


Api Usage

Implement your RecyclerViewItem. Each RecyclerViewItem will be rendered as a row of your RecyclerView.

public class MyViewItem : RecyclerViewItem
{
    public TextView Caption = new TextView();
    public ImageView Image = new ImageView();

    public override async Task OnInitializing()
    {
        await base.OnInitializing();

        await Content.Add(Caption);
        await Content.Add(Image);
    }
}

Next, implement your Adapter. Adapter will be in charge of hosting your data and binding the RecyclerViewItems as needed.

public class MyAdapter : Adapter<Data>
{
    readonly List<Data> items;

    public MyAdapter(List<Data> items) : base(items)
    {
        this.items = items;
    }

    public override RecyclerViewItem OnCreateViewItem()
    {
        return new MyViewItem();
    }

    public override void OnBindViewItem(RecyclerViewItem recyclerViewItem, int position)
    {
        var viewItem = (MyViewItem) recyclerViewItem;

        viewItem.Caption.Text = items[position].Title;
        viewItem.Image.Path = items[position].ImageFile;
    }
}

And lastly, add the RecyclerView to your page. Note that you need to specify the height of the RecyclerViewItem.

var data = GetData();
var adapter = new MyAdapter(data);
var recyclerView = new RecyclerView<Data>(adapter, 170);

await Body.Add(recyclerView);

About

RecyclerView is a more advanced ListView focused on performance

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages