microsoft/teams.net
Publicmirrored from https://github.com/microsoft/teams.netAvailable
Libraries/Microsoft.Teams.Cards/Containers/ColumnSet.cs
74lines · modecode
| 1 | using System.Text.Json.Serialization; |
| 2 | |
| 3 | using Microsoft.Teams.Common; |
| 4 | |
| 5 | namespace Microsoft.Teams.Cards; |
| 6 | |
| 7 | public partial class CardType : StringEnum |
| 8 | { |
| 9 | public static readonly CardType ColumnSet = new("ColumnSet"); |
| 10 | public bool IsColumnSet => ColumnSet.Equals(Value); |
| 11 | } |
| 12 | |
| 13 | /// <summary> |
| 14 | /// ColumnSet divides a region into Columns, allowing elements to sit side-by-side. |
| 15 | /// </summary> |
| 16 | public class ColumnSet(params Column[] columns) : ContainerElement(CardType.ColumnSet) |
| 17 | { |
| 18 | /// <summary> |
| 19 | /// The array of `Columns` to divide the region into. |
| 20 | /// </summary> |
| 21 | [JsonPropertyName("columns")] |
| 22 | [JsonPropertyOrder(18)] |
| 23 | public IList<Column> Columns { get; set; } = columns; |
| 24 | |
| 25 | /// <summary> |
| 26 | /// The minimum height, in pixels, of the container, in the <number>px format. |
| 27 | /// </summary> |
| 28 | [JsonPropertyName("minHeight")] |
| 29 | [JsonPropertyOrder(19)] |
| 30 | public string? MinHeight { get; set; } |
| 31 | |
| 32 | /// <summary> |
| 33 | /// Style hint for `Container`. |
| 34 | /// </summary> |
| 35 | [JsonPropertyName("style")] |
| 36 | [JsonPropertyOrder(20)] |
| 37 | public ContainerStyle? Style { get; set; } |
| 38 | |
| 39 | /// <summary> |
| 40 | /// Defines how the content should be aligned vertically within the container. When not specified, the value of verticalContentAlignment is inherited from the parent container. If no parent container has verticalContentAlignment set, it defaults to Top. |
| 41 | /// </summary> |
| 42 | [JsonPropertyName("horizontalContentAlignment")] |
| 43 | [JsonPropertyOrder(22)] |
| 44 | public HorizontalAlignment? HorizontalContentAlignment; |
| 45 | |
| 46 | public ColumnSet WithStyle(ContainerStyle value) |
| 47 | { |
| 48 | Style = value; |
| 49 | return this; |
| 50 | } |
| 51 | |
| 52 | public ColumnSet WithHorizontalContentAlignment(HorizontalAlignment value) |
| 53 | { |
| 54 | HorizontalContentAlignment = value; |
| 55 | return this; |
| 56 | } |
| 57 | |
| 58 | public ColumnSet WithMinHeight(string value) |
| 59 | { |
| 60 | MinHeight = value; |
| 61 | return this; |
| 62 | } |
| 63 | |
| 64 | |
| 65 | public ColumnSet AddColumns(params Column[] value) |
| 66 | { |
| 67 | foreach (var card in value) |
| 68 | { |
| 69 | Columns.Add(card); |
| 70 | } |
| 71 | |
| 72 | return this; |
| 73 | } |
| 74 | } |