Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>This block of code feels like it might be confusing your display:</p> <pre><code> var row = this.GetCell(tableView, indexPath); (row as FamilysubgroupViewCell).ExpandCells(); tableView.ReloadRows(new[] { indexPath }, UITableViewRowAnimation.Automatic); </code></pre> <p>What this does is:</p> <ul> <li>get the current cell and tell it to expand</li> <li>then ask the table to reload the row (at which point a different cell instance might be used).</li> </ul> <p>I'd also worry that the line:</p> <pre><code> var context = this.DataContext as FamilySubTypeViewModel; </code></pre> <p>would link your cells sub-display to the current viewmodel - and this wouldn't update if the cell were reused (given a new viewmodel).</p> <p>One quick (and only slightly dirty) way around both of these problems would be to change the override for <code>GetOrCreateCellFor</code> to something like:</p> <pre><code>protected override UITableViewCell GetOrCreateCellFor(UITableView tableView, NSIndexPath indexPath, object item) { var cell = tableView.DequeueReusableCell(_key); cell.Frame = new RectangleF(cell.Frame.X, cell.Frame.Y, cell.Frame.Width, GetHeightForRow(tableView, indexPath)); ((MyCellType)cell).ShowExpandedState(expandableState[items[indexPath.Row]]); return cell; } </code></pre> <p>Where <code>ShowExpandedState(bool)</code> would be capable of resetting the cell's expanded area after reuse.</p> <hr> <p>Other options:</p> <ul> <li>Instead of this, you could simply return a different cell type for expanded versus non-expanded rows? </li> <li>Or you could put the expanded/non-expanded information in the Cell's ViewModel so that it can data-bind to that expanded state and update it's own layout? (you'd still need some mechanism to tell the table about the size change though)</li> </ul> <hr> <p>On: </p> <pre><code>this.Draw(this.Bounds); </code></pre> <p>I'm not too surprised this didn't work - generally you have to encourage the system to redraw views - using things like <code>SetNeedsDisplay</code> (and sometimes after child changes <code>SetNeedsLayout</code> too)</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload