Skip to content

Commit

Permalink
Fix collection default spacing, also re-enable the failing test (#17261)
Browse files Browse the repository at this point in the history
Co-authored-by: Mike Corsaro <mikecorsaro@microsoft.com>
  • Loading branch information
Foda and Mike Corsaro authored Sep 8, 2023
1 parent 2068ae8 commit 65edfe0
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,19 @@ public static class CollectionViewExtensions

var style = new WStyle(typeof(GridViewItem));

if (layout?.Orientation == ItemsLayoutOrientation.Vertical)
{
style.Setters.Add(new WSetter(FrameworkElement.MinHeightProperty, 0));
style.Setters.Add(new WSetter(Control.HorizontalContentAlignmentProperty, HorizontalAlignment.Stretch));
}
else if (layout?.Orientation == ItemsLayoutOrientation.Horizontal)
{
style.Setters.Add(new WSetter(FrameworkElement.MinWidthProperty, 0));
style.Setters.Add(new WSetter(Control.VerticalContentAlignmentProperty, VerticalAlignment.Stretch));
}

style.Setters.Add(new WSetter(FrameworkElement.MarginProperty, margin));
style.Setters.Add(new WSetter(Control.PaddingProperty, WinUIHelpers.CreateThickness(0)));
style.Setters.Add(new WSetter(Control.HorizontalContentAlignmentProperty, HorizontalAlignment.Stretch));

return style;
}
Expand All @@ -37,9 +47,19 @@ public static class CollectionViewExtensions

var style = new WStyle(typeof(GridViewItem));

if (layout?.Orientation == ItemsLayoutOrientation.Vertical)
{
style.Setters.Add(new WSetter(FrameworkElement.MinHeightProperty, 0));
style.Setters.Add(new WSetter(Control.HorizontalContentAlignmentProperty, HorizontalAlignment.Stretch));
}
else if (layout?.Orientation == ItemsLayoutOrientation.Horizontal)
{
style.Setters.Add(new WSetter(FrameworkElement.MinWidthProperty, 0));
style.Setters.Add(new WSetter(Control.VerticalContentAlignmentProperty, VerticalAlignment.Stretch));
}

style.Setters.Add(new WSetter(FrameworkElement.MarginProperty, margin));
style.Setters.Add(new WSetter(Control.PaddingProperty, WinUIHelpers.CreateThickness(0)));
style.Setters.Add(new WSetter(Control.HorizontalContentAlignmentProperty, HorizontalAlignment.Stretch));

return style;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ await CreateHandlerAndAddToWindow<LayoutHandler>(layout, (handler) =>
});
}

[Fact(Skip = "FIX FOR .NET8")]
[Fact]
public async Task ValidateItemContainerDefaultHeight()
{
SetupBuilder();
Expand Down

0 comments on commit 65edfe0

Please sign in to comment.