Created
October 29, 2015 18:55
-
-
Save jonstodle/6d6cebdb00c8c9cdd94a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected override Size MeasureOverride(Size availableSize) | |
{ | |
var finalSize = new Size { Width = availableSize.Width }; | |
var rowHeight = 0d; | |
var posX = 0d; | |
foreach (var child in Children) | |
{ | |
child.Measure(availableSize); | |
posX += child.DesiredSize.Width; | |
if (posX > availableSize.Width) | |
{ | |
posX = child.DesiredSize.Width; | |
finalSize.Height += rowHeight; | |
rowHeight = child.DesiredSize.Height; | |
} | |
else | |
{ | |
rowHeight = Math.Max(child.DesiredSize.Height, rowHeight); | |
} | |
} | |
finalSize.Height += rowHeight; | |
return finalSize; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment