public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) { UITableViewCell cell = tableView.DequeueReusableCell("cell"); OptionInfo info = null; if (this.owner.owner.Sections.Length > 0) { OptionSection sectionInfo = this.owner.owner.Sections [indexPath.Section]; info = sectionInfo.Items [indexPath.Row]; if (indexPath.Row == sectionInfo.SelectedOption) { cell.Accessory = UITableViewCellAccessory.Checkmark; } } else { info = this.owner.owner.Options [indexPath.Row]; if (indexPath.Row == this.owner.owner.SelectedOption) { cell.Accessory = UITableViewCellAccessory.Checkmark; } } cell.TextLabel.Text = info.OptionText; cell.SelectionStyle = UITableViewCellSelectionStyle.None; return(cell); }
public override void RowSelected(UITableView tableView, NSIndexPath indexPath) { this.owner.owner.SelectedOption = indexPath.Row; OptionInfo info = null; if (this.owner.owner.Sections.Length > 0) { OptionSection sectionInfo = this.owner.owner.Sections [indexPath.Section]; info = sectionInfo.Items [indexPath.Row]; sectionInfo.SelectedOption = indexPath.Row; } else { info = this.owner.owner.Options [indexPath.Row]; this.owner.owner.SelectedOption = indexPath.Row; } if (info.Handler != null) { info.Handler(info, EventArgs.Empty); } if (this.owner.owner.Popover != null && this.owner.owner.Popover.PopoverVisible) { this.owner.owner.Popover.Dismiss(false); } else { this.owner.NavigationController.PopViewController(true); } }
public override nint RowsInSection(UITableView tableView, nint section) { if (this.owner.owner.Sections.Length > 0) { OptionSection sectionInfo = this.owner.owner.Sections[section]; return(sectionInfo.Items.Count); } return(owner.owner.Options.Length); }
void AddOptionInSection(OptionInfo option, string sectionName) { foreach (OptionSection section in this.sections) { if (section.Title.Equals(sectionName)) { section.Items.Add(option); return; } } OptionSection newSection = new OptionSection(sectionName); newSection.Items.Add(option); this.sections.Add(newSection); }
public void SetSelectedOptionInSection(int selectedOption, int section) { OptionSection sec = sections [section]; sec.SelectedOption = selectedOption; }
void AddOptionInSection(OptionInfo option, string sectionName) { foreach (OptionSection section in this.sections) { if (section.Title.Equals(sectionName)) { section.Items.Add (option); return; } } OptionSection newSection = new OptionSection(sectionName); newSection.Items.Add(option); this.sections.Add(newSection); }
public override string TitleForHeader(UITableView tableView, nint section) { OptionSection sectionInfo = this.owner.owner.Sections[section]; return(sectionInfo.Title); }