How to to clear the data in ListView

Thombre, Ashish 130 Reputation points
2023-12-15T06:30:31.0433333+00:00

i am using ListView.ItemsSource = null; to clear the Listview item but items from list not able to clear/delete/refresh.

but when click/tap on list item second time then only item clearing/refreshing.

Developer technologies .NET .NET MAUI
{count} votes

Accepted answer
  1. Wenyan Zhang (Shanghai Wicresoft Co,.Ltd.) 36,436 Reputation points Microsoft External Staff
    2023-12-22T05:33:02.2166667+00:00

    Hello,

    Please try to add a <VrticalStackLayout> to wrap the Listview.

    <VerticalStackLayout
          VerticalOptions="Center">
          <ListView ...>
          </ListView>
    
    
      </VerticalStackLayout>
    

    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.

    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.