public void TestViewBoxUniformStretch() { Viewbox vb = new Viewbox(); vb.Height = 300; vb.Width = 300; vb.Stretch = Stretch.Uniform; CheckBox cb = new CheckBox(); cb.Content = "Check box"; vb.Child = cb; Point pt = new Point(); Grid cp = new Grid(); TestAsync( vb, () => cp = (Grid)VisualTreeHelper.GetParent(vb), () => pt = vb.TransformToVisual(cp).Transform(new Point(0, 0)), () => Assert.IsTrue(TestExtensions.AreClose((cp.ActualHeight - vb.ActualHeight) / 2, pt.Y))); }
public void TestViewBoxUniformStretch() { Viewbox vb = new Viewbox(); vb.Height = 300; vb.Width = 300; vb.Stretch = Stretch.Uniform; CheckBox cb = new CheckBox(); cb.Content = "Check box"; vb.Child = cb; Point pt = new Point(); Grid cp = new Grid(); TestAsync( vb, () => cp = (Grid)VisualTreeHelper.GetParent(vb), () => pt = vb.TransformToVisual(cp).Transform(new Point(0, 0)), () => Assert.IsTrue(TestExtensions.AreClose((cp.ActualHeight - vb.ActualHeight) / 2, pt.Y))); }