This repository has been archived by the owner on Sep 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVeilingListAdapter.cs
executable file
·63 lines (51 loc) · 2.09 KB
/
VeilingListAdapter.cs
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
55
56
57
58
59
60
61
62
using System.Collections.Generic;
using Android.App;
using Android.Widget;
namespace Veiling
{
public class VeilingListAdapter : BaseAdapter<VeilingItem>
{
Activity context = null;
IList<VeilingItem> items = new List<VeilingItem>();
public VeilingListAdapter(Activity context, IList<VeilingItem> items) : base()
{
this.context = context;
this.items = items;
}
public override VeilingItem this [int position]
{
get { return items[position]; }
}
public override long GetItemId(int position)
{
return position;
}
public override int Count
{
get { return items.Count; }
}
public override Android.Views.View GetView(int position, Android.Views.View convertView, Android.Views.ViewGroup parent)
{
// Get our object for position
var item = items[position];
//Try to reuse convertView if it's not null, otherwise inflate it from our item layout
// gives us some performance gains by not always inflating a new view
var view = (convertView ??
context.LayoutInflater.Inflate(
Resource.Layout.ItemRy,
parent,
false)) as LinearLayout;
// Find references to each subview in the list item's view
var txtNommer = view.FindViewById<TextView>(Resource.Id.itemNommer);
var txtBeskrywing = view.FindViewById<TextView>(Resource.Id.itemBeskrywing);
var txtBedrag = view.FindViewById<TextView>(Resource.Id.itemBedrag);
// Assign item's values to the various subviews
txtNommer.SetText(item.nommer, TextView.BufferType.Normal);
txtBeskrywing.SetText(item.beskrywing, TextView.BufferType.Normal);
txtBedrag.SetText(item.bedrag.ToString("#,##0.00"), TextView.BufferType.Normal);
txtBedrag.Selected = item.betaal;
txtBeskrywing.Selected = item.betaal;
return view;
}
}
}