/// <summary>
        /// Adds a row to the collection.
        /// </summary>
        /// <returns>The row that was added to the collection.</returns>
        public TextTableRow <ViewModelType> Add()
        {
            var row = new TextTableRow <ViewModelType>(table);

            AddInternal(row);
            table.MarkDirty();
            return(row);
        }
예제 #2
0
        /// <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="TextTableCell{ViewModelType}"/> class.
        /// </summary>
        /// <param name="row">The row that owns the cell.</param>
        internal TextTableCell(TextTableRow <ViewModelType> row)
        {
            Contract.Require(row, nameof(row));

            this.row = row;
        }