Empty view not showing .net maui

Mielesplayz 291 Reputation points
2022-09-15T12:35:59.687+00:00

I have a collection for achievements but the list starts off empty, so I wanted to add an emptyview, but for some reason it won't show on Android.
On Windows it works just fine.
is there any way I can fix this?

241494-image-2022-09-15-143454171.png

Developer technologies | .NET | .NET MAUI
0 comments No comments
{count} votes

Accepted answer
  1. Wenyan Zhang (Shanghai Wicresoft Co,.Ltd.) 36,436 Reputation points Microsoft External Staff
    2022-09-16T08:05:23.83+00:00

    Hello @Mielesplayz ,

    I tested on Android, iOS and Windows, it doesn't work on Android . When data is not available, you can display a string but not views.

    <CollectionView ItemsSource="{Binding EmptyMonkeys}"  
                    EmptyView="No items to display" />  
    

    There is a known issue reported at GitHub- Collection View Header and Empty View not showing on Android #8934, you could follow the progress.

    If you want to display an empty view, you have to create a custom control using handlers in MAUI. The native Android control for CollectionView is RecyclerView, you could try to add an empty view to the RecyclerView.

    Best Regards,
    Wenyan Zhang


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    2 people found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.