public override UITableViewCell GetCell (UITableView tv)
{
var cell = tv.DequeueReusableCell (rkey);
if (cell == null){
var style = CellStyle !=null? CellStyle : (UITableViewCellStyle) (summarySection == -1 ? UITableViewCellStyle.Default : UITableViewCellStyle.Value1);
cell = new UITableViewCell (style, rkey+this.CellStyle.ToString());
cell.SelectionStyle = UITableViewCellSelectionStyle.Blue;
}
cell.TextLabel.Text = Caption;
cell.TextLabel.Font = Appearance.LabelFont;
cell.TextLabel.TextColor = this.ReadOnly ? Appearance.DisabledLabelTextColor : Appearance.LabelTextColor;
cell.TextLabel.HighlightedTextColor = this.ReadOnly ? Appearance.DisabledLabelTextColor : Appearance.LabelHighlightedTextColor;
if (cell.DetailTextLabel!=null) {
cell.DetailTextLabel.Text = "";
cell.DetailTextLabel.Font = Appearance.DetailLabelFont;
cell.DetailTextLabel.TextColor = this.ReadOnly ? Appearance.DisabledLabelTextColor : Appearance.DetailLabelTextColor;
cell.DetailTextLabel.HighlightedTextColor = Appearance.DetailLabelHighlightedTextColor;
}
cell.UserInteractionEnabled = !this.ReadOnly;
cell.BackgroundColor = this.ReadOnly ? Appearance.BackgroundColorDisabled : Appearance.BackgroundColorEditable;
var radio = group as RadioGroup;
if (radio != null){
int selected = radio.Selected;
int current = 0;
foreach (var s in Sections){
foreach (var e in s.Elements){
if (!(e is RadioElement))
continue;
if (current == selected && cell.DetailTextLabel!=null){
cell.DetailTextLabel.Text = e.Summary ();
goto le;
}
current++;
}
}
} else if (group != null){
int count = 0;
foreach (var s in Sections){
foreach (var e in s.Elements){
var ce = e as CheckboxElement;
if (ce != null){
if (ce.Value)
count++;
continue;
}
var be = e as BooleanElement;
if (be != null){
if (be.Value)
count++;
continue;
}
}
}
cell.DetailTextLabel.Text = count.ToString ();
} else if (summarySection != -1 && summarySection < Sections.Count){
var s = Sections [summarySection];
if (summaryElement < s.Elements.Count)
cell.DetailTextLabel.Text = s.Elements [summaryElement].Summary ();
}
le:
cell.Accessory = this.ReadOnly ? UITableViewCellAccessory.None: UITableViewCellAccessory.DisclosureIndicator;
return cell;
}