Created
February 11, 2016 22:32
-
-
Save jassmith/0ecd3bab3ced9dd78c5f 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
using System; | |
using Windows.Foundation; | |
using Windows.UI.Xaml.Controls; | |
namespace MeasureScrewsArrange | |
{ | |
public class FUPanel : Panel | |
{ | |
public FUPanel () | |
{ | |
for (int i = 0; i < 10; i++) { | |
Children.Add (new Button {Content = i.ToString ()}); | |
} | |
} | |
protected override Size ArrangeOverride (Size finalSize) | |
{ | |
// Why is the following loop needed at all? It does nothing, just measure. Why? | |
int x = 10; | |
foreach (var child in Children) { | |
child.Arrange (new Rect (x, 0, 100, 100)); | |
x += 110; | |
} | |
return base.ArrangeOverride (finalSize); | |
} | |
protected override Size MeasureOverride (Size availableSize) | |
{ | |
return new Size (Children.Count*110 + 10, 100); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment