本文整理汇总了C#中System.Windows.Size.Merge方法的典型用法代码示例。如果您正苦于以下问题:C# Size.Merge方法的具体用法?C# Size.Merge怎么用?C# Size.Merge使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Size
的用法示例。
在下文中一共展示了Size.Merge方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MeasureOverride
protected override Size MeasureOverride(Size availableSize)
{
if (Children == null || Children.Count < 1)
{
return new Size (0, 0);
}
var resultingRect = new Rect ();
object accumulatedState = null;
try
{
var count = Children.Count;
for (var iter = 0; iter < count; ++iter)
{
var child = Children[iter];
child.Measure (availableSize);
var desiredSize = child.DesiredSize;
var args = new LayoutItemEventArgs
{
LayoutItemState = LayoutItemState.IsMeasuring,
UiElement = child,
AccumulateState = accumulatedState,
State = GetUIElementState (child),
AvailableSize = availableSize,
DesiredSize = desiredSize,
Count = count,
Index = iter,
Transform = child.RenderTransform,
};
OnItemLayout (args);
accumulatedState = args.AccumulateState;
var childRect = (args.Transform ?? s_identityTransform).TransformBounds (new Rect (0, 0, desiredSize.Width, desiredSize.Height));
resultingRect.Union (childRect);
}
return availableSize.Merge (resultingRect.ToSize ());
}
finally
{
Common.Dispose (accumulatedState);
}
}