@@ -150,7 +150,8 @@ protected override Size MeasureOverride(Size availableSize)
150
150
/// <inheritdoc />
151
151
protected override Size ArrangeOverride ( Size finalSize )
152
152
{
153
- if ( finalSize != DesiredSize )
153
+ if ( ( Orientation == Orientation . Horizontal && finalSize . Width < DesiredSize . Width ) ||
154
+ ( Orientation == Orientation . Vertical && finalSize . Height < DesiredSize . Height ) )
154
155
{
155
156
// We haven't received our desired size. We need to refresh the rows.
156
157
UpdateRows ( finalSize ) ;
@@ -180,18 +181,21 @@ protected override Size ArrangeOverride(Size finalSize)
180
181
return finalSize ;
181
182
}
182
183
183
- private Size UpdateRows ( Size finalSize )
184
+ private Size UpdateRows ( Size availableSize )
184
185
{
185
186
_rows . Clear ( ) ;
187
+
188
+ var paddingStart = new UvMeasure ( Orientation , Padding . Left , Padding . Top ) ;
189
+ var paddingEnd = new UvMeasure ( Orientation , Padding . Right , Padding . Bottom ) ;
190
+
186
191
if ( Children . Count == 0 )
187
192
{
188
- return Size . Empty ;
193
+ var emptySize = paddingStart . Add ( paddingEnd ) . ToSize ( Orientation ) ;
194
+ return emptySize ;
189
195
}
190
196
191
- var parentMeasure = new UvMeasure ( Orientation , finalSize . Width , finalSize . Height ) ;
197
+ var parentMeasure = new UvMeasure ( Orientation , availableSize . Width , availableSize . Height ) ;
192
198
var spacingMeasure = new UvMeasure ( Orientation , HorizontalSpacing , VerticalSpacing ) ;
193
- var paddingStart = new UvMeasure ( Orientation , Padding . Left , Padding . Top ) ;
194
- var paddingEnd = new UvMeasure ( Orientation , Padding . Right , Padding . Bottom ) ;
195
199
var position = new UvMeasure ( Orientation , Padding . Left , Padding . Top ) ;
196
200
197
201
var currentRow = new Row ( new List < UvRect > ( ) , default ) ;
@@ -241,7 +245,8 @@ void Arrange(UIElement child, bool isLast = false)
241
245
242
246
if ( _rows . Count == 0 )
243
247
{
244
- return Size . Empty ;
248
+ var emptySize = paddingStart . Add ( paddingEnd ) . ToSize ( Orientation ) ;
249
+ return emptySize ;
245
250
}
246
251
247
252
// Get max V here before computing final rect
0 commit comments