// Weighted children are not measured at this phase.
// Available space for weighted children will be calculated in the phase 2 based on totalLength value.
// Max height of children is stored.
- foreach( LayoutItem childLayout in LayoutChildren )
+ for (int i = 0; i < LayoutChildren.Count; i++)
{
+ LayoutItem childLayout = LayoutChildren[i];
int childDesiredHeight = childLayout.Owner.HeightSpecification;
float childWeight = childLayout.Owner.Weight;
Extents childMargin = childLayout.Margin;
}
else
{
- _totalLength = Math.Max(_totalLength, _totalLength + length.AsDecimal() + CellPadding.Width);
+ _totalLength = Math.Max(_totalLength, _totalLength + length.AsDecimal() + (i < LayoutChildren.Count - 1 ? CellPadding.Width : 0));
}
}
// to accumulate total used space in _totalLength.
// Weighted children are not measured in this phase.
// Available space for weighted children will be calculated in the phase 2 based on _totalLength value.
- foreach( LayoutItem childLayout in LayoutChildren )
+ for (int i = 0; i < LayoutChildren.Count; i++)
{
+ LayoutItem childLayout = LayoutChildren[i];
int childDesiredWidth = childLayout.Owner.WidthSpecification;
float childWeight = childLayout.Owner.Weight;
Extents childMargin = childLayout.Margin;
}
else
{
- _totalLength = Math.Max(_totalLength, _totalLength + length.AsDecimal() + CellPadding.Height);
+ _totalLength = Math.Max(_totalLength, _totalLength + length.AsDecimal() + (i < LayoutChildren.Count - 1 ? CellPadding.Height : 0));
}
}
}
childLeft += childMargin.Start;
childLayout.Layout(childLeft, childTop, childLeft + childWidth, childTop + childHeight);
- childLeft += childWidth + childMargin.End + CellPadding.Width;
+ childLeft += childWidth + childMargin.End + ((i < count - 1) ? CellPadding.Width : 0);
}
}
} // LayoutHorizontally
}
}
childLayout.Layout( childLeft, childTop, childLeft + childWidth, childTop + childHeight );
- childTop += childHeight + childMargin.Bottom + CellPadding.Height;
+ childTop += childHeight + childMargin.Bottom + ((i < count - 1) ? CellPadding.Height : 0);
}
}
} // LayoutVertical