forked from Clancey/MonoDroid.Dialog
-
Notifications
You must be signed in to change notification settings - Fork 7
/
DialogListView.cs
57 lines (48 loc) · 1.46 KB
/
DialogListView.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
using System;
using Android.Content;
using Android.Util;
using Android.Widget;
namespace Android.Dialog
{
public class DialogListView : ListView
{
public RootElement Root
{
get { return DialogAdapter == null ? null : DialogAdapter.Root; }
set
{
value.Context = Context;
value.ValueChanged -= HandleValueChangedEvent;
value.ValueChanged += HandleValueChangedEvent;
if (DialogAdapter == null)
Adapter = DialogAdapter = new DialogAdapter(Context, value, this);
else
DialogAdapter.Root = value;
}
}
public DialogAdapter DialogAdapter { get; set; }
public DialogListView(Context context) :
base(context, null)
{
}
public DialogListView(Context context, IAttributeSet attrs) :
base(context, attrs)
{
}
public DialogListView(Context context, IAttributeSet attrs, int defStyle) :
base(context, attrs, defStyle)
{
}
public event EventHandler ValueChanged;
private void HandleValueChangedEvent(object sender, EventArgs args)
{
if (ValueChanged != null)
ValueChanged(sender, args);
}
public void ReloadData()
{
if (Root == null) return;
DialogAdapter.ReloadData();
}
}
}