Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[regression/8.0.0-preview.4.8333] CollectionView has default spacing between items on Windows which I cannot remove #12495

Closed
samuelradford opened this issue Jan 7, 2023 · 3 comments · Fixed by #12811 or #17261
Labels
area-controls-collectionview CollectionView, CarouselView, IndicatorView fixed-in-7.0.96 Look for this fix in 7.0.96 SR8! fixed-in-7.0.100 fixed-in-7.0.101 fixed-in-8.0.0-preview.1.7762 Look for this fix in 8.0.0-preview.1.7762! fixed-in-8.0.0-rc.2.9373 Look for this fix in 8.0.0-rc.2.9373! i/regression This issue described a confirmed regression on a currently supported version platform/windows 🪟 t/bug Something isn't working
Milestone

Comments

@samuelradford
Copy link

samuelradford commented Jan 7, 2023

Description

The documentation says that a CollectionView has no default spacing between items. However, when adding a simple Label element, there is clear spacing between the items. I have tried multiple ways to remove this but cannot seem to find a way.

This happens on Windows. MacCatalyst seems OK.

Steps to Reproduce

  1. Create a new .NET MAUI project
  2. Remove the default MainPage.xaml content and replace with the following:
    <Grid RowDefinitions="*"
          ColumnDefinitions="*">
        <CollectionView Grid.Row="0" Grid.Column="0" 
                        ItemsSource="{Binding Strings}"
                        BackgroundColor="Red">
            <CollectionView.ItemTemplate>
                <DataTemplate x:DataType="local:MainPage">
                    <Label Text="{Binding .}"
                           TextColor="Black"
                           FontSize="14"
                           BackgroundColor="Yellow"/>
                </DataTemplate>
            </CollectionView.ItemTemplate>
        </CollectionView>
    </Grid>
  1. Remove the default MainPage.xaml.cs code behind and replace with the following:
public partial class MainPage : ContentPage
{
    public List<string> Strings { get; set; }
    public MainPage()
	  {
               InitializeComponent();
               Strings = new();
               AddStrings();
	       BindingContext = this;
	  }
    void AddStrings()
    {
        for (var i = 0; i < 10; i++)
        {
            Strings.Add("CollectionView shouldn't have spacing between items");
        }
    }
}
  1. Run the application

In my example I have set the CollectionView background to Red and the Label's to Yellow to clearly show where the spacing occurs.

You can see in this example that the Labels have space between then, even though in the documentation it says:

image

Source - https://learn.microsoft.com/en-us/dotnet/maui/user-interface/controls/collectionview/layout?view=net-maui-7.0

Example of application running

image

Link to public reproduction project repository

https://github.com/samuelradford/Reproduction.MAUICollectionViewSpacing

Version with bug

7.0 (current)

Last version that worked well

Unknown/Other

Affected platforms

Windows

Affected platform versions

Windows 11 (OS Build: 22000.1335)

Did you find any workaround?

No response

Relevant log output

No response

@samuelradford samuelradford added the t/bug Something isn't working label Jan 7, 2023
@Vroomer
Copy link

Vroomer commented Jan 8, 2023

Duplicate of #4520

It's indeed annyoing bug and so far I didn't see any workaround for this.

@jsuarezruiz jsuarezruiz added platform/windows 🪟 area-controls-collectionview CollectionView, CarouselView, IndicatorView labels Jan 9, 2023
@jsuarezruiz jsuarezruiz added this to the Backlog milestone Jan 9, 2023
@ghost
Copy link

ghost commented Jan 9, 2023

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

@jsuarezruiz jsuarezruiz self-assigned this Jan 20, 2023
@samhouts samhouts added the fixed-in-8.0.0-preview.1.7762 Look for this fix in 8.0.0-preview.1.7762! label Feb 22, 2023
@samhouts samhouts modified the milestones: Backlog, 8.0-preview1 Feb 22, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Mar 24, 2023
@PureWeen PureWeen reopened this Sep 7, 2023
@PureWeen PureWeen modified the milestones: 8.0-preview1, .NET 8 GA Sep 7, 2023
@PureWeen PureWeen added i/regression This issue described a confirmed regression on a currently supported version and removed fixed-in-8.0.0-preview.1.7762 Look for this fix in 8.0.0-preview.1.7762! labels Sep 7, 2023
@samhouts samhouts changed the title CollectionView has default spacing between items on Windows which I cannot remove [regression/8.0.0] CollectionView has default spacing between items on Windows which I cannot remove Sep 18, 2023
@samhouts samhouts changed the title [regression/8.0.0] CollectionView has default spacing between items on Windows which I cannot remove [regression/8.0.0-preview.4.8333] CollectionView has default spacing between items on Windows which I cannot remove Sep 18, 2023
@samhouts samhouts added fixed-in-8.0.0-rc.2.9373 Look for this fix in 8.0.0-rc.2.9373! fixed-in-7.0.96 Look for this fix in 7.0.96 SR8! labels Oct 10, 2023
@samhouts samhouts added fixed-in-8.0.0-preview.1.7762 Look for this fix in 8.0.0-preview.1.7762! fixed-in-7.0.101 labels Jan 31, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-controls-collectionview CollectionView, CarouselView, IndicatorView fixed-in-7.0.96 Look for this fix in 7.0.96 SR8! fixed-in-7.0.100 fixed-in-7.0.101 fixed-in-8.0.0-preview.1.7762 Look for this fix in 8.0.0-preview.1.7762! fixed-in-8.0.0-rc.2.9373 Look for this fix in 8.0.0-rc.2.9373! i/regression This issue described a confirmed regression on a currently supported version platform/windows 🪟 t/bug Something isn't working
Projects
None yet
5 participants