Skip to content

Commit

Permalink
Fix SimpleStackPanel issue with hidden children (#74)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kinnara committed Apr 22, 2020
1 parent 084a562 commit e0443a3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions ModernWpf/Controls/SimpleStackPanel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ protected override Size MeasureOverride(Size constraint)

if (child == null) { continue; }

bool isVisible = child.Visibility == Visibility.Visible;
bool isVisible = child.Visibility != Visibility.Collapsed;

if (isVisible && !hasVisibleChild)
{
Expand Down Expand Up @@ -178,7 +178,10 @@ protected override Size ArrangeOverride(Size arrangeSize)
rcChild.Width = Math.Max(arrangeSize.Width, child.DesiredSize.Width);
}

previousChildSize += spacing;
if (child.Visibility != Visibility.Collapsed)
{
previousChildSize += spacing;
}

child.Arrange(rcChild);
}
Expand Down

0 comments on commit e0443a3

Please sign in to comment.