From 26c4e2891cd3ee1ca07c0b45f079897d491c984f Mon Sep 17 00:00:00 2001 From: Govardhan N <78958353+ggovardh@users.noreply.github.com> Date: Wed, 12 Jul 2023 17:40:02 +0530 Subject: [PATCH] Vertical Alignment for Cards (#397) * Card Vertical Alignment * Height Calculation FIxed --- .../Library/RendererQml/AdaptiveCardQmlRenderer.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/source/qml/Library/RendererQml/AdaptiveCardQmlRenderer.cpp b/source/qml/Library/RendererQml/AdaptiveCardQmlRenderer.cpp index c48284d901..39ceef8fec 100644 --- a/source/qml/Library/RendererQml/AdaptiveCardQmlRenderer.cpp +++ b/source/qml/Library/RendererQml/AdaptiveCardQmlRenderer.cpp @@ -226,9 +226,20 @@ namespace RendererQml if (card->GetMinHeight() > 0) { - rectangle->Property("Layout.minimumHeight", std::to_string(cardMinHeight)); + columnLayout->Property("height", Formatter() << "Math.max(" << std::to_string(card->GetMinHeight()) << ", " << rectangle->GetId() << ".height + " << tempMargin << ")"); } + switch (card->GetVerticalContentAlignment()) + { + case AdaptiveCards::VerticalContentAlignment::Top: + rectangle->Property("Layout.alignment", "Qt.AlignTop"); + break; + case AdaptiveCards::VerticalContentAlignment::Bottom: + rectangle->Property("Layout.alignment", "Qt.AlignBottom"); + break; + } + uiCard->Property("Layout.preferredHeight", Formatter() << columnLayout->GetId() << ".height"); + //Add submit onclick event addSubmitActionButtonClickFunc(context); addShowCardLoaderComponents(context);