-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
CollectionView ItemSpacing cannot be set below an arbitrary value #4520
Comments
I did some additional testing using the sample app and confirmed that the fixed minimum row height is indeed the culprit.
I am attaching a slightly updated version of the sample code. |
Verified Repro with windows and the above project. |
That's the OnMeasure for ItemsView, not for individual items - the entire CollectionView can't be less than 40x40. It doesn't have anything to do with the height of individual rows. Also, it's there to support legacy renderer shims; I don't believe it ever gets called if you're using a vanilla CollectionView with Since you're only seeing this behavior on Windows, it's unlikely that the culprit is any of the cross-platform code. I don't have time to dig into it during this iteration, but my best guess is that you're seeing an issue with the underlying WinUI ListView's individual row height. Or that the |
By no means am I an expert in MAUI but it looks like this may be due to inferring styles from their default styles.
IIRC, the default UWP Since there doesn't seem to be a way to set the This behavior doesn't occur if you use a |
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. |
Description
I am using a CollectionView to present a list of Text items (Labels) in a "green-bar" or "gray-bar" list. Unfortunately, the items cannot be set to abut one another; i.e. the items are always separated by a minimum size gap. Research has shown that this gap size is a function of a hard coded minimum size which was inherited from ListView and, likely from Xamarin Forms.
It is not possible to implement my application with this limitation in place. My application is for Windows Desktop application but the affliction is likely multi-platform since it is found in shared code.
My biggest objection is that setting ItemSpacing to zero does not reduce the gap between items to 0, but to some internally predetermined, non-overridable, minimum. ItemSpacing=0 should mean just that; no gap between items.
A sample application is attached
CollectionViewItemSpacingBug.zip
Steps to Reproduce
Version with bug
Preview 12 (current)
Last version that worked well
Unknown/Other
Affected platforms
Windows, I was not able test on other platforms
Affected platform versions
Windows SDK 10.0.18362 and later
Did you find any workaround?
No
Relevant log output
I was able to locate the likely culprit. Note that the following is the CollectionView inheritance
hierarchy (code is from the Preview 12 branch):
CollectionView -> GroupableItemsView -> SelectableItemsView -> StructuredItemsView -> ItemsView
ItemsView implements OnMeasure as follows:
Note hartez comment from 2018 that the minimum size is arbitrarily set to 40, 40, meaning that the item can never be smaller.
The text was updated successfully, but these errors were encountered: