SizeF ComputeEntryPosition (UITableView tv, UITableViewCell cell)
{
Section s = Parent as Section;
if (s.EntryAlignment.Width != 0)
return s.EntryAlignment;
// If all EntryElements have a null Caption, align UITextField with the Caption
// offset of normal cells (at 10px).
SizeF max = new SizeF (-15, tv.StringSize ("M", font).Height);
foreach (var e in s.Elements) {
var ee = e as EntryElement;
if (ee == null)
continue;
if (ee.Caption != null) {
var size = tv.StringSize (ee.Caption, font);
if (size.Width > max.Width)
max = size;
}
}
s.EntryAlignment = new SizeF (25 + Math.Min (max.Width, 160), max.Height);
return s.EntryAlignment;
}