本文整理汇总了C#中System.Windows.Controls.Grid.CheckMeasureSizes方法的典型用法代码示例。如果您正苦于以下问题:C# Grid.CheckMeasureSizes方法的具体用法?C# Grid.CheckMeasureSizes怎么用?C# Grid.CheckMeasureSizes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Controls.Grid
的用法示例。
在下文中一共展示了Grid.CheckMeasureSizes方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MeasureAutoAndFixedRows
public void MeasureAutoAndFixedRows ()
{
Grid grid = new Grid { };
grid.AddColumns (new GridLength (50), new GridLength (50));
grid.AddRows (new GridLength (20), new GridLength (20));
grid.AddChild (new MyContentControl (50, 50), 0, 1, 2, 1);
grid.Measure (Infinity);
grid.CheckRowHeights ("#1", 20, 20);
grid.CheckMeasureSizes ("#2", new Size (50, 40));
Assert.AreEqual (new Size (100, 40), grid.DesiredSize, "#3");
grid.RowDefinitions [0].Height = new GridLength (30);
grid.Measure (Infinity);
grid.CheckRowHeights ("#4", 30, 20);
grid.CheckMeasureSizes ("#5", new Size (50, 50));
Assert.AreEqual (new Size (100, 50), grid.DesiredSize, "#6");
grid.RowDefinitions.Insert (0, new RowDefinition { Height = GridLength.Auto });
grid.Measure (Infinity);
grid.CheckRowHeights ("#7", double.PositiveInfinity, 30, 20);
grid.CheckMeasureSizes ("#8", new Size (50, double.PositiveInfinity));
Assert.AreEqual (new Size (100, 70), grid.DesiredSize, "#9");
grid.Children.Clear ();
grid.AddChild (new MyContentControl (50, 150), 0, 1, 2, 1);
grid.Measure (Infinity);
grid.CheckDesired ("#13", new Size (50, 150));
grid.CheckRowHeights ("#10", double.PositiveInfinity, 30, 20);
grid.CheckMeasureSizes ("#11", new Size (50, double.PositiveInfinity));
grid.CheckMeasureResult ("#12", new Size (50, 150));
Assert.AreEqual (new Size (100, 170), grid.DesiredSize, "#12");
}