forked from Clancey/MonoDroid.Dialog
-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathMultilineElement.cs
More file actions
29 lines (27 loc) · 864 Bytes
/
MultilineElement.cs
File metadata and controls
29 lines (27 loc) · 864 Bytes
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
using Android.Content;
using Android.Views;
namespace Android.Dialog
{
public class MultilineEntryElement : EntryElement
{
public int MaxLength { get; set; }
public MultilineEntryElement(string caption, string value)
: base(caption, value, Resource.Layout.dialog_textfieldbelow)
{
Lines = 3;
}
public override View GetView(Context context, View convertView, ViewGroup parent)
{
var view = base.GetView(context, convertView, parent);
if (_entry != null)
{
_entry.TextChanged += delegate
{
if (MaxLength > 0 && _entry.Text.Length > MaxLength)
_entry.Text = _entry.Text.Substring(0, MaxLength);
};
}
return view;
}
}
}