Skip to content

Collection View Header and Empty View not showing on Android when ItemSource is null #8934

Closed

Description

@3steve3

Description

If the data the CollectionView is bound to is null, then CollectionView.Header and CollectionView.Empty View is not visible. This issue was also tested on the Windows version and the bug does not appear.
A sample of the issue can be found here https://github.com/3steve3/EmptyCollectionViewBug

Steps to Reproduce

  1. Create a new .Net Maui project
  2. Create a viewmodel for the view
  3. Create a Collection View in the View.
  4. Bind the Collection View item source to null variable, CollectionView.Header and CollectionView.EmptyView will not be visible on Android.

Version with bug

6.0.400

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

Android 12

Did you find any workaround?

No

Relevant log output

No response

Activity

  1. added
    s/needs-verification
    t/bug
    on Jul 22, 2022
  2. added
    area-controls-collectionview
    and removed
    s/needs-verification
    on Jul 25, 2022
  3. added this to the 6.0-servicing milestone on Jul 25, 2022
  4. danielftz commented on Aug 29, 2022

    @danielftz

    ETA on the fix?

  5. modified the milestones: 6.0-servicing, Backlog on Aug 30, 2022
  6. 99067718 commented on Sep 16, 2022

    @99067718

    I'm pretty sure the header is the problem in your case.
    It should be fixed after you remove the header.

  7. 3steve3 commented on Sep 16, 2022

    @3steve3
    Author

    My application needs to have things in a header (if using a collection view) because stacking content and a collection view results in incorrect scroll height.

  8. Syed-RI commented on Nov 3, 2022

    @Syed-RI

    cc @davidortinau @jfversluis @PureWeen . This is a basic requirement thats failing us now. Can you please assign resources in this issue please? I know you guys are working hard and really appreciate the work :) Thank you!

  9. 3steve3 commented on Nov 6, 2022

    @3steve3
    Author

    This is the general workaround I came up with until the bug is fixed

    <ScrollView>
        <StackLayout>
            This is where the header elements would be
        
          <VerticalStackLayout BindableLayout.ItemsSource="{Binding mySource}">
              <BindableLayout.ItemTemplate>
                  <DataTemplate x:DataType="model:MyModel">
                      the bindable content here
                  </DataTemplate>
              </BindableLayout.ItemTemplate>
          </VerticalStackLayout>
      </StackLayout>
    </ScrollView>
    
  10. AlexeyStarkov commented on Feb 1, 2023

    @AlexeyStarkov

    CarouselView has the same issue: Empty view doesn't work on Android whether the source collection is null or empty.

  11. 13 remaining items

  12. added a commit that references this issue on Jun 15, 2023
    f358ddc
  13. added a commit that references this issue on Jun 26, 2023
    ae6a614
  14. PureWeen commented on Jun 28, 2023

    @PureWeen
    Member
  15. added a commit that references this issue on Jul 3, 2023
    6022c81
  16. added a commit that references this issue on Jul 5, 2023
    4cd5c23
  17. added a commit that references this issue on Jul 10, 2023
    b9f64e1
  18. added
    fixed-in-8.0.0-preview.7.8842
    on Aug 8, 2023
  19. ghost locked as resolved and limited conversation to collaborators on Sep 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area-controls-collectionviewfixed-in-8.0.0-preview.7.8842p/1platform/androids/triageds/verifiedt/bug

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions