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

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

Closed
3steve3 opened this issue Jul 22, 2022 · 12 comments · Fixed by #15979
Closed

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

3steve3 opened this issue Jul 22, 2022 · 12 comments · Fixed by #15979
Assignees
Labels
area-controls-collectionview CollectionView, CarouselView, IndicatorView fixed-in-8.0.0-preview.7.8842 Look for this fix in 8.0.0-preview.7.8842! p/1 Work that is important, and has been scheduled for release in this or an upcoming sprint platform/android 🤖 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working

Comments

@3steve3
Copy link

3steve3 commented Jul 22, 2022

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

@3steve3 3steve3 added s/needs-verification Indicates that this issue needs initial verification before further triage will happen t/bug Something isn't working labels Jul 22, 2022
@jfversluis jfversluis added platform/android 🤖 area-controls-collectionview CollectionView, CarouselView, IndicatorView and removed s/needs-verification Indicates that this issue needs initial verification before further triage will happen labels Jul 25, 2022
@jfversluis jfversluis added this to the 6.0-servicing milestone Jul 25, 2022
@danielftz
Copy link

ETA on the fix?

@Redth Redth modified the milestones: 6.0-servicing, Backlog Aug 30, 2022
@ghost
Copy link

ghost commented Aug 30, 2022

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.

@99067718
Copy link

99067718 commented Sep 16, 2022

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

@3steve3
Copy link
Author

3steve3 commented Sep 16, 2022

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.

@Syed-RI
Copy link

Syed-RI commented Nov 3, 2022

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!

@3steve3
Copy link
Author

3steve3 commented Nov 6, 2022

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>

@AlexeyStarkov
Copy link

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

@BurkusCat
Copy link
Contributor

To confirm for CollectionView: an empty ObservableCollection does not show the empty view on Android for me.

@samhouts samhouts added the p/1 Work that is important, and has been scheduled for release in this or an upcoming sprint label Apr 25, 2023
WilliamChavula referenced this issue in WilliamChavula/maui-tripshare Apr 29, 2023
@XamlTest XamlTest added s/verified Verified / Reproducible Issue ready for Engineering Triage s/triaged Issue has been reviewed labels May 24, 2023
@XamlTest
Copy link

Verified this on Visual Studio Enterprise 17.7.0 Preview 1.0. Repro on Android 13.0 with below Project:
8934.zip

Android: CollectionView.Header and CollectionView.EmptyView is not visible.
image

Windows: CollectionView.Header is not visible, CollectionView.EmptyView is visible.
image

@samhouts samhouts modified the milestones: Backlog, .NET 8 May 24, 2023
@HobDev
Copy link

HobDev commented May 30, 2023

The empty view only shows up in collectionview if it is set to a string., Facing same issue on Windows too.

@hartez hartez self-assigned this Jun 15, 2023
@hartez
Copy link
Contributor

hartez commented Jun 15, 2023

#11763 Fixes part of this issue; with that fix applied, the EmptyView will show up as long as there is no header or footer specified.

If a header and/or footer are specified, grouping is not enabled, and the items source does not implement INotifyCollectionChanged, then an empty/null ItemsSource will cause the EmptyView, the Header, and the Footer to disappear. Working on a PR for that right now.

@PureWeen
Copy link
Member

#15886

@PureWeen PureWeen reopened this Jun 28, 2023
hartez added a commit that referenced this issue Jul 3, 2023
github-actions bot pushed a commit that referenced this issue Jul 5, 2023
PureWeen pushed a commit that referenced this issue Jul 10, 2023
…msSource is null (#15979)

* Include headers/footers in EmptySource count so they show up when ItemsSource is null
Fixes #8934

* More tests
@samhouts samhouts added the fixed-in-8.0.0-preview.7.8842 Look for this fix in 8.0.0-preview.7.8842! label Aug 8, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Sep 7, 2023
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-8.0.0-preview.7.8842 Look for this fix in 8.0.0-preview.7.8842! p/1 Work that is important, and has been scheduled for release in this or an upcoming sprint platform/android 🤖 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.