public void Format(PFormSection section, object item) { var cell = this; var theme = Theme.Current; theme.Apply(cell); if (useBlur) { BackgroundColor = theme.TableCellBackgroundColor.ColorWithAlpha(0.5f); } var itemTitle = section.GetItemTitle(item); cell.TextLabel.Text = itemTitle; cell.TextLabel.AccessibilityLabel = itemTitle; cell.TextLabel.BackgroundColor = UIColor.Clear; var display = section.GetItemDisplay(item); if (display != PFormItemDisplay.Title) { cell.DetailTextLabel.Text = section.GetItemDetails(item) ?? ""; if (display == PFormItemDisplay.TitleAndValue) { cell.DetailTextLabel.TextColor = UIApplication.SharedApplication.KeyWindow.TintColor; } } var imageUrl = section.GetItemImage(item); if (string.IsNullOrEmpty(imageUrl)) { cell.ImageView.Image = null; } else { UIImage image; if (!imageCache.TryGetValue(imageUrl, out image)) { image = UIImage.FromBundle(imageUrl); imageCache.Add(imageUrl, image); } cell.ImageView.Image = image; } if (section.GetItemChecked(item)) { cell.Accessory = UITableViewCellAccessory.Checkmark; theme.ApplyChecked(cell); } else { cell.Accessory = section.GetItemNavigates(item) ? UITableViewCellAccessory.DisclosureIndicator : UITableViewCellAccessory.None; } if (section.GetItemEnabled(item)) { var cmd = item as Command; if (cmd != null) { theme.ApplyCommand(cell); } cell.SelectionStyle = UITableViewCellSelectionStyle.Blue; } else { cell.TextLabel.TextColor = UIColor.LightGray; cell.SelectionStyle = UITableViewCellSelectionStyle.None; } }
public void FormatCell (PFormCell cell, PFormSection section, object item) { var theme = Theme.Current; theme.Apply (cell); var itemTitle = section.GetItemTitle (item); cell.TextLabel.Text = itemTitle; cell.TextLabel.AccessibilityLabel = itemTitle; cell.TextLabel.BackgroundColor = UIColor.Clear; var display = section.GetItemDisplay (item); if (display != PFormItemDisplay.Title) { cell.DetailTextLabel.Text = section.GetItemDetails (item) ?? ""; if (display == PFormItemDisplay.TitleAndValue) { cell.DetailTextLabel.TextColor = UIApplication.SharedApplication.KeyWindow.TintColor; } } var imageUrl = section.GetItemImage (item); if (string.IsNullOrEmpty (imageUrl)) { cell.ImageView.Image = null; } else { UIImage image; if (!imageCache.TryGetValue (imageUrl, out image)) { image = UIImage.FromBundle (imageUrl); imageCache.Add (imageUrl, image); } cell.ImageView.Image = image; } if (section.GetItemChecked (item)) { cell.Accessory = UITableViewCellAccessory.Checkmark; theme.ApplyChecked (cell); } else { cell.Accessory = section.GetItemNavigates (item) ? UITableViewCellAccessory.DisclosureIndicator : UITableViewCellAccessory.None; } if (section.GetItemEnabled (item)) { var cmd = item as Command; if (cmd != null) { theme.ApplyCommand (cell); } cell.SelectionStyle = UITableViewCellSelectionStyle.Blue; } else { cell.TextLabel.TextColor = UIColor.LightGray; cell.SelectionStyle = UITableViewCellSelectionStyle.None; } }