Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions source/uwp/SharedRenderer/lib/AdaptiveCarouselRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,21 @@ namespace winrt::AdaptiveCards::Rendering::Xaml_Rendering::implementation
}

uint32_t carouselMinHeight = styledCollection.MinHeight();
auto fixedHeightInPixel = carousel.HeightInPixels();

// Ensure MinHeight doesn't exceed fixed height to prevent AG_E_LAYOUT_CYCLE
if (carouselMinHeight > 0)
{
gridContainer.MinHeight(carouselMinHeight);
if (fixedHeightInPixel && carouselMinHeight > fixedHeightInPixel)
{
gridContainer.MinHeight(static_cast<double>(fixedHeightInPixel));
}
else
{
gridContainer.MinHeight(carouselMinHeight);
}
}

auto fixedHeightInPixel = carousel.HeightInPixels();
if (fixedHeightInPixel)
{
carouselUI.MaxHeight(static_cast<double>(fixedHeightInPixel));
Expand Down
11 changes: 10 additions & 1 deletion source/uwp/SharedRenderer/lib/XamlBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,16 @@ namespace AdaptiveCards::Rendering::Xaml_Rendering

if (cardMinHeight > 0)
{
rootAsFrameworkElement.MinHeight(cardMinHeight);
// If fixed dimensions are set, ensure MinHeight doesn't exceed MaxHeight to prevent AG_E_LAYOUT_CYCLE
if (xamlBuilder && xamlBuilder->m_fixedDimensions && cardMinHeight > xamlBuilder->m_fixedHeight)
{
// Clamp MinHeight to not exceed the fixed height constraint
rootAsFrameworkElement.MinHeight(xamlBuilder->m_fixedHeight);
}
else
{
rootAsFrameworkElement.MinHeight(cardMinHeight);
}
}

auto selectAction = adaptiveCard.SelectAction();
Expand Down
Loading