How do I databind a ColumnDefinition’s Width or RowDefinition’s Height?

Create a IValueConverter as follows: public class GridLengthConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { double val = (double)value; GridLength gridLength = new GridLength(val); return gridLength; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { GridLength val = (GridLength)value; return val.Value; } } You can … Read more

Dynamic Height Issue for UITableView Cells (Swift)

Try This: func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat { return UITableViewAutomaticDimension } EDIT func tableView(tableView: UITableView, estimatedHeightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat { return UITableViewAutomaticDimension } Swift 4 func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat { return UITableViewAutomaticDimension } Swift 4.2 func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat { return … Read more

Setting custom UITableViewCells height

Your UITableViewDelegate should implement tableView:heightForRowAtIndexPath: Objective-C – (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { return [indexPath row] * 20; } Swift 5 func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { return indexPath.row * 20 } You will probably want to use NSString‘s sizeWithFont:constrainedToSize:lineBreakMode: method to calculate your row height rather than just performing some silly … Read more