/// <summary> /// Fill in the contents of the view (invoked by the layout manager) /// </summary> public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position) { ResultViewHolder vh = holder as ResultViewHolder; vh.ResultView.ConditionName = conditionNames[(int)ConditionResults[position].Condition]; vh.ResultView.Likelihood = ConditionResults[position].Score.Likelihood; vh.ResultView.LikelihoodLabel = likelihoodLabels[(int)LikelihoodLabelHelper.FromLikelihood(ConditionResults[position].Score.Likelihood)]; vh.ResultView.Highlighted = ConditionResults[position].Selected; vh.ResultView.HighlightColor = ConditionResults[position].HighlightColor.ToColor(); }
/// <summary> /// Get a cell to be rendered to the UITableView /// NOTE: This method is called: /// - At initialization (for all cells) /// - When a cell is about to be rendered to the screen (for particular cell) /// - When tableView.ReloadData() is called (for all cells) <see cref="RowSelected(UITableView, NSIndexPath)"/> /// </summary> /// <param name="tableView">UITableView associated with this UITableViewSource</param> /// <param name="indexPath">Index of cell</param> /// <returns>The cell to be displayed</returns> public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) { // Get cell ConditionViewCell cell; // PrimaryCondition.xib if (indexPath.Row == 0 && tableType == TableType.Primary) { cell = tableView.DequeueReusableCell(ConditionViewCell.PrimaryCellReuseId) as ConditionViewCell; // The primary cell's voice over will always be enabled // as it is always visible EnableCellVoiceOver(cell, true); } else { // Condition.xib cell = tableView.DequeueReusableCell(ConditionViewCell.CellReuseId) as ConditionViewCell; // Enable/disable voice over for secondary cells bool enable = tableType == TableType.Secondary ? !seeMoreVisible : seeMoreVisible; EnableCellVoiceOver(cell, enable); } // Turn off selection styling cell.SelectionStyle = UITableViewCellSelectionStyle.None; // Set Background color cell.HighlightedBgColor = models[indexPath.Row].HighlightColor.ToUIColor(); // Check if the cell is highlighted cell.IsHighlighted = models[indexPath.Row].Selected; // Set Labels of cell to be accessible cell.ConfigureAccessibleLabels(); // Set attributes of cell string condition = Constants.ConditionList[(int)models[indexPath.Row].Condition]; float likelihood = models[indexPath.Row].Score.Likelihood; cell.ConditionName = condition; cell.Likelihood = likelihood; // Set Likelihood label for cell LikelihoodLabel enumlabel = LikelihoodLabelHelper.FromLikelihood(likelihood); cell.LikelihoodText = Constants.LikelihoodLabel[(int)enumlabel]; return(cell); }