Add row and column accessors for tables and grids

This commit is contained in:
Patrik Svensson
2020-10-26 11:51:35 +01:00
committed by Patrik Svensson
parent 3e5e22d6c2
commit e7f497050c
30 changed files with 511 additions and 162 deletions

View File

@ -24,5 +24,24 @@ namespace Spectre.Console
obj.NoWrap = true;
return obj;
}
/// <summary>
/// Sets the width of the column.
/// </summary>
/// <typeparam name="T">An object implementing <see cref="IColumn"/>.</typeparam>
/// <param name="obj">The column.</param>
/// <param name="width">The column width.</param>
/// <returns>The same instance so that multiple calls can be chained.</returns>
public static T Width<T>(this T obj, int? width)
where T : class, IColumn
{
if (obj is null)
{
throw new ArgumentNullException(nameof(obj));
}
obj.Width = width;
return obj;
}
}
}