void UpdateView(ChangeViewModel model) { ChangeView.DisableShadows(); ChangeView.SchoolClassLabel.Text = model.ClassName; ChangeView.HoursLabel.Text = model.Day + ", " + model.Hours + " " + NSBundle.MainBundle.LocalizedString("change_suffix_hour", ""); ChangeView.ChangeLabel.Text = NSBundle.MainBundle.LocalizedString(model.Type, ""); ChangeView.SchoolGradientView.Gradient = model.FillColor; ChangeView.OriginalLessonLabel.AttributedText = TextComponentFormatter.AttributedStringForTextComponents(model.OldLesson, true); ChangeView.ChangeDescriptionLabel.AttributedText = TextComponentFormatter.AttributedStringForTextComponents(model.Description, false); // Calculate the dynamic content size with the width restricted to the view's width and a boundless height. // Set the priority for the width to required (so it doesn't get larger than the available space) the priority of the height to low PreferredContentSize = ChangeView.SystemLayoutSizeFittingSize(new CoreGraphics.CGSize(View.Bounds.Size.Width, nfloat.MaxValue), 1000, 100); }
public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) { ChangeTableViewCell cell = (ChangeTableViewCell)tableView.DequeueReusableCell(ChangeTableViewCell.Key, indexPath); var change = Items[indexPath.Row]; cell.SchoolClassLabel.Text = change.ClassName; cell.HoursLabel.Text = change.Hours + " " + NSBundle.MainBundle.LocalizedString("change_suffix_hour", ""); cell.ChangeLabel.Text = NSBundle.MainBundle.LocalizedString(change.Type, ""); cell.SchoolGradientView.Gradient = change.FillColor; cell.OriginalLessonLabel.AttributedText = TextComponentFormatter.AttributedStringForTextComponents(change.OldLesson, true); cell.ChangeDescriptionLabel.AttributedText = TextComponentFormatter.AttributedStringForTextComponents(change.Description, false); if (Context.TraitCollection.ForceTouchCapability == UIForceTouchCapability.Available) { Context.RegisterForPreviewingWithDelegate(Context, cell.ContentView); } return(cell); }