-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDemiProductListAdapter.cs
More file actions
54 lines (43 loc) · 1.46 KB
/
DemiProductListAdapter.cs
File metadata and controls
54 lines (43 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Support.V7.Widget;
using Android.Views;
using Android.Widget;
namespace po4
{
public class DemiProductListAdapter : RecyclerView.Adapter
{
public event EventHandler<int> ItemClick;
public DemiProductList mProductList;
public DemiProductListAdapter (DemiProductList productList)
{
mProductList = productList;
}
public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType)
{
View itemView = LayoutInflater.From(parent.Context).Inflate(Resource.Layout.DemiCategoryCardView, parent, false);
DemiRecycleViewHolderClass vh = new DemiRecycleViewHolderClass(itemView, OnClick);
return vh;
}
public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position)
{
DemiRecycleViewHolderClass vh = holder as DemiRecycleViewHolderClass;
vh.Category.Text = mProductList[position].category.ToString();
//vh.Group.Text = mProductList[position].GroupName;
}
public override int ItemCount
{
get { return mProductList.NumProducts; }
}
void OnClick (int position)
{
if (ItemClick != null) ItemClick(this, position);
}
}
}