File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
Microsoft.Toolkit.Uwp.UI.Controls.Primitives/WrapPanel Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -166,6 +166,13 @@ protected override Size ArrangeOverride(Size finalSize)
166166 foreach ( var rect in row . ChildrenRects )
167167 {
168168 var child = Children [ childIndex ++ ] ;
169+ while ( child . Visibility == Visibility . Collapsed )
170+ {
171+ // Collapsed children are not added into the rows,
172+ // we skip them.
173+ child = Children [ childIndex ++ ] ;
174+ }
175+
169176 var arrangeRect = new UvRect
170177 {
171178 Position = rect . Position ,
@@ -202,12 +209,12 @@ private Size UpdateRows(Size availableSize)
202209 var finalMeasure = new UvMeasure ( Orientation , width : 0.0 , height : 0.0 ) ;
203210 void Arrange ( UIElement child , bool isLast = false )
204211 {
205- var desiredMeasure = new UvMeasure ( Orientation , child . DesiredSize ) ;
206- if ( desiredMeasure . U == 0 )
212+ if ( child . Visibility == Visibility . Collapsed )
207213 {
208214 return ; // if an item is collapsed, avoid adding the spacing
209215 }
210216
217+ var desiredMeasure = new UvMeasure ( Orientation , child . DesiredSize ) ;
211218 if ( ( desiredMeasure . U + position . U + paddingEnd . U ) > parentMeasure . U )
212219 {
213220 // next row!
You can’t perform that action at this time.
0 commit comments