dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
22.05k stars 1.73k forks source link

[BUG] Margin and Padding don't work in CollectionView #23211

Open acaliaro opened 3 months ago

acaliaro commented 3 months ago

Description

On iOS Margin and Padding don't work in CollectionView. In the attached example, I have 3 collection views.

I have seen that in the past some bugs relating to these problems have already been opened, apparently resolved, but apparently not correctly

Steps to Reproduce

Run the project presso "popup problem!!!!" button a page with 3 collections should appears

Link to public reproduction project repository

https://github.com/acaliaro/MauiCollectionViewPaddingProblems

Version with bug

8.0.60 SR6

Is this a regression from previous behavior?

Yes, this used to work in .NET MAUI, Yes, this used to work in Xamarin.Forms

Last version that worked well

Unknown/Other

Affected platforms

iOS

Affected platform versions

iOS 17.3 iphone 12

Did you find any workaround?

I think this could help https://github.com/dotnet/maui/issues/17885#issuecomment-1963641251

Relevant log output

No response

github-actions[bot] commented 3 months ago

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Open similar issues:

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

Zhanglirong-Winnie commented 3 months ago

This issue has been verified using Visual Studio 17.11.0 Preview 2.1 (8.0.40 & 8.0.60 & 8.0.14). Can be reproduced on iOS platform.

acaliaro commented 3 months ago

@PureWeen moved to the Backlog?

This problem in the collectionview has probably been present since the first version of Maui, and do we still want to move it to the backlog? How can we have a decent UI if these basic things aren't fixed?

CC @samhouts @davidortinau @jfversluis

jfversluis commented 3 months ago

How can we have a decent UI if these basic things aren't fixed?

Moving something to the backlog does not mean it will not be fixed and also doesn't necessarily mean it will not be fixed soon, although of course no promises. Its just a way for us to organize things, please don't jump to any conclusions about it. We continuously monitor our issues and change priorities accordingly.

More information about this process can be found here.

acaliaro commented 3 months ago

How can we have a decent UI if these basic things aren't fixed?

Moving something to the backlog does not mean it will not be fixed and also doesn't necessarily mean it will not be fixed soon, although of course no promises. Its just a way for us to organize things, please don't jump to any conclusions about it. We continuously monitor our issues and change priorities accordingly.

More information about this process can be found here.

Thanks @jfversluis . I have seven issues, six of which are in the backlog as of January 2023, and still open. Do you understand why every time something gets put on the backlog, the blood in my veins freezes? However, I hope it is handled with the right priority given the difficulty in having a correct UI. Thanks for the effort. Good day

jfversluis commented 3 months ago

@acaliaro I definitely understand! I hope the linked doc will help you understand our side of things as well. Of course we want to fix all the things for everyone, unfortunately we have to make choices based on what has the most impact at that time. As mentioned: we continuously refine our priorities based on signals we see.

Of course, if this is really something that is blocking you, there is always the possibility to pull down the repository and provide pull requests to get things moving and not only help yourself but also everyone else.

If there is more you would like to discuss please feel free to open a discussion on the Discussions tab or reach out to me directly just so we don't go off topic with this issue, which will not help it get resolved any sooner 😄 thanks!

acaliaro commented 3 months ago

@samhouts Hi. Any news about this?

kiddailey commented 2 months ago

Just to document my experience because this isn't limited to iOS. I have the same issue on Windows.

I have a Border view directly in a collection view DataTemplate and the Margin values have no affect at all on Windows. I'm trying to add a Border to each item in the CollectionView and add spacing in between them.

For example, the Margins on the Border in this example are completely ignored (although the Padding does work):

<CollectionView.ItemTemplate>
    <DataTemplate>
        <Border Margin="0,0,0,10" Padding="10,5"> ... </Border>
    </DataTemplate>
</CollectionView.ItemTemplate>

If I simply wrap the Border in a Grid (or any other type of container View) without changing anything else then the margins on the border suddenly work. For example:

<CollectionView.ItemTemplate>
    <DataTemplate>
        <Grid>
            <Border Margin="0,0,0,10" Padding="10,5"> ... </Border>
        </Grid>
    </DataTemplate>
</CollectionView.ItemTemplate>

It's worth noting that the obsolete Frame View also behaves this same way. Margins on Grids, Stacklayouts, etc work as expected.

Domik234 commented 2 months ago

Hey, we've always used wrapping to ContentView to make it work even in Xamarin.Forms.

Currently I am doing it too and it works as expected for MAUI.

Using the padding or margin directly on root view in item template had always some problems depending on used platform.

acaliaro commented 1 month ago

there are some news about this issue? Will be moved on a sprint?

acaliaro commented 1 week ago

Hi. Are there some news about this?

RsZoli commented 4 days ago

Well if you are so fast on closing issues about key problems, i would also like to know the current state about this, because its blocking us to deploy on other platforms than Android!

@samhouts Please?