format conditionals

This commit is contained in:
Rudy Huyn 2019-03-20 14:06:12 -07:00
commit c213768121
2 changed files with 7 additions and 3 deletions

View file

@ -42,7 +42,9 @@ Size HorizontalNoOverflowStackPanel::ArrangeOverride(Size finalSize)
auto lastChild = Children->GetAt(Children->Size - 1);
float lastChildWidth = 0;
if (Children->Size > 2 && ShouldPrioritizeLastItem())
{
lastChildWidth = lastChild->DesiredSize.Width;
}
for (auto item : Children)
{
auto widthAvailable = finalSize.Width - posX;

View file

@ -72,12 +72,14 @@ SupplementaryResults::SupplementaryResults()
bool SupplementaryResultNoOverflowStackPanel::ShouldPrioritizeLastItem()
{
if (Children->Size == 0)
{
return false;
}
auto lastChild = dynamic_cast<FrameworkElement^>(Children->GetAt(Children->Size - 1));
if (lastChild == nullptr)
{
return false;
auto suppResult = dynamic_cast<SupplementaryResult^>(lastChild->DataContext);
if (suppResult == nullptr)
return false;
return suppResult->IsWhimsical();
}
auto suppResult = dynamic_cast<SupplementaryResult^>(lastChild->DataContext);
return suppResult == nullptr? false: suppResult->IsWhimsical();
}