本文整理汇总了C#中GridLength.GetLength方法的典型用法代码示例。如果您正苦于以下问题:C# GridLength.GetLength方法的具体用法?C# GridLength.GetLength怎么用?C# GridLength.GetLength使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GridLength
的用法示例。
在下文中一共展示了GridLength.GetLength方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetupGrid
/// <summary>method initialize grid
/// </summary>
/// <param name="grid">grid being initialized</param>
/// <param name="colWidth">array of column's width in GridLength units</param>
/// <param name="rowCount">rows count</param>
/// <param name="gridWidth">optional grid width in inches</param>
/// <param name="margin">optional grid margin</param>
public static void SetupGrid(Grid grid, GridLength[] colWidth, int rowCount, double gridWidth = 0.0, Thickness? margin = null)
{
int i;
int colCount = colWidth.GetLength(0);
for (i = 0; i < colCount; i++)
{
grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = colWidth[i] });
}
for (i = 0; i < rowCount; i++)
{
grid.RowDefinitions.Add(new RowDefinition());
}
if (gridWidth > 0.0) grid.Width = gridWidth * ReportPage.DisplayResolution;
if(margin.HasValue) grid.Margin = (Thickness)margin;
}