Merge pull request #35 from nventive/dev/dr/SuggestedResultNoOverflow

Hide items measured 0,0
This commit is contained in:
David 2019-05-24 13:17:22 -04:00 committed by GitHub
commit 6b59b615f6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -19,11 +19,20 @@ namespace CalculatorApp.Controls
{
double maxHeight = 0;
double width = 0;
// TODO UNO
var childSize = new Size(double.PositiveInfinity, double.PositiveInfinity);
foreach (UIElement child in Children)
{
child.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
child.Measure(childSize);
maxHeight = Math.Max(maxHeight, child.DesiredSize.Height);
width += child.DesiredSize.Width;
// TODO UNO
if (width > availableSize.Width)
{
childSize = new Size(0, 0);
}
}
return new Size(Math.Min(width, availableSize.Width), Math.Min(availableSize.Height, maxHeight));
}
@ -64,7 +73,7 @@ namespace CalculatorApp.Controls
else
{
// Not display the item
item.Arrange(new Rect(0, 0, 0, 0));
item.Arrange(new Rect(50000 /* TODO UNO */, 0, 0, 0));
}
}
return finalSize;