本文整理汇总了C#中Windows.UI.Xaml.Controls.Canvas.Measure方法的典型用法代码示例。如果您正苦于以下问题:C# Canvas.Measure方法的具体用法?C# Canvas.Measure怎么用?C# Canvas.Measure使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Windows.UI.Xaml.Controls.Canvas
的用法示例。
在下文中一共展示了Canvas.Measure方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MeasureOverride
protected override Size MeasureOverride( Size availableSize )
{
if ( Days == null )
{
return availableSize;
}
Children.Clear();
_arrangeSizes.Clear();
var minMax = GetHourBoundaries( Days );
_minHour = minMax.Item1;
_maxHour = minMax.Item2;
var hoursGrid = CreateHoursGrid();
Children.Add( hoursGrid );
hoursGrid.Measure( new Size( HoursGridWidth, availableSize.Height ) );
_arrangeSizes.Add( hoursGrid, new Rect( 0, 0, HoursGridWidth, availableSize.Height ) );
var displayedDays = Day == null ? Days : new[] { Day };
double canvasWidth = ( availableSize.Width - HoursGridWidth ) / displayedDays.Length;
for ( int n = 0; n < displayedDays.Length; n++ )
{
var canvas = new Canvas();
var size = new Size( canvasWidth, availableSize.Height );
AddPlaceholdersToCanvas( canvas, size );
AddPeriodsToCanvas( canvas, size, displayedDays[n] );
Children.Add( canvas );
canvas.Measure( size );
_arrangeSizes.Add( canvas, new Rect( Math.Floor( HoursGridWidth + canvasWidth * n ), 0, canvasWidth, availableSize.Height ) );
}
return availableSize;
}