public void Lays_Out_Children_Vertical() { var target = new ProportionalStackPanel() { Width = 100, Height = 300, Orientation = Orientation.Vertical, Children = { new Rectangle(), new ProportionalStackPanelSplitter(), new Rectangle() } }; target.Measure(Size.Infinity); target.Arrange(new Rect(target.DesiredSize)); Assert.Equal(new Size(100, 300), target.Bounds.Size); Assert.Equal(new Rect(0, 0, 100, 148), target.Children[0].Bounds); Assert.Equal(new Rect(0, 148, 100, 0), target.Children[1].Bounds); Assert.Equal(new Rect(0, 148, 100, 148), target.Children[2].Bounds); }
public void Lays_Out_Children_Default() { var target = new ProportionalStackPanel() { Width = 1000, Height = 500, Orientation = Orientation.Horizontal, Children = { new ProportionalStackPanel() { Children = { new Rectangle() { Fill = Brushes.Red, [ProportionalStackPanelSplitter.ProportionProperty] = 0.5 }, new ProportionalStackPanelSplitter(), new Rectangle() { Fill = Brushes.Green }, new ProportionalStackPanelSplitter(), new Rectangle() { Fill = Brushes.Blue } } }, new ProportionalStackPanelSplitter(), new ProportionalStackPanel() { Children = { new Rectangle() { Fill = Brushes.Blue, }, new ProportionalStackPanelSplitter(), new Rectangle() { Fill = Brushes.Red }, new ProportionalStackPanelSplitter(), new Rectangle() { Fill = Brushes.Green } } }, new ProportionalStackPanelSplitter(), new ProportionalStackPanel() { Children = { new Rectangle() { Fill = Brushes.Green, }, new ProportionalStackPanelSplitter(), new Rectangle() { Fill = Brushes.Blue }, new ProportionalStackPanelSplitter(), new Rectangle() { Fill = Brushes.Red, [ProportionalStackPanelSplitter.ProportionProperty] = 0.5 } } }, } }; target.Measure(Size.Infinity); target.Arrange(new Rect(target.DesiredSize)); Assert.Equal(new Size(1000, 500), target.Bounds.Size); Assert.Equal(new Rect(0, 0, 331, 500), target.Children[0].Bounds); Assert.Equal(new Rect(330, 0, 0, 500), target.Children[1].Bounds); Assert.Equal(new Rect(330, 0, 331, 500), target.Children[2].Bounds); Assert.Equal(new Rect(661, 0, 0, 500), target.Children[3].Bounds); Assert.Equal(new Rect(661, 0, 331, 500), target.Children[4].Bounds); }