[FIXED] How to get Xamarin form each CollectionView item?

Issue

I wanna change each ItemsSource,but I don’t know how to do it?

A simple Code blow:

  •   async private void SearchBar_SearchButtonPressed(object sender, EventArgs e)
      {
          ClassA ChangeTextA = new ClassA();
          CollectionView BKcv = new CollectionView();
          BKcv.ItemsSource = await MyDB.search(ChangeTextA.Change(sbar.Text));
          //How to get each item and make some change?
          myCV.ItemsSource = BKcv.ItemsSource;
      }
    

Solution

var items = await MyDB.search(ChangeTextA.Change(sbar.Text));

foreach (var x in items)
{
  // change some properties on x
}

BKcv.ItemsSource = items;
 

Answered By – Jason

Answer Checked By – Mary Flores (Easybugfix Volunteer)

Leave a Reply

(*) Required, Your email will not be published