public TextTableRow <ViewModelType> Add() { var row = new TextTableRow <ViewModelType>(table); AddInternal(row); table.MarkDirty(); return(row); }
/// <summary> /// Calculates the width of automatically-sized cells on the specified row. /// </summary> /// <param name="row">The row to evaluate.</param> /// <returns>The width of automatically-sized cells on the specified row.</returns> private Int32 CalculateAutomaticWidth(TextTableRow <ViewModelType> row) { var availableWidth = width; var automaticallySizedCells = 0; foreach (var cell in row.Cells) { if (cell.Width == null) { automaticallySizedCells++; } else { availableWidth -= cell.Width.GetValueOrDefault(); } } return((automaticallySizedCells == 0) ? 0 : availableWidth / automaticallySizedCells); }
/// <summary> /// Initializes a new instance of the <see cref="TextTableCellCollection{ViewModelType}"/>. /// </summary> /// <param name="row">The row that owns the collection.</param> internal TextTableCellCollection(TextTableRow <ViewModelType> row) { Contract.Require(row, nameof(row)); this.row = row; }