Home > database >  How to get Xamarin form each CollectionView item?
How to get Xamarin form each CollectionView item?

Time:07-05

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;
      }
    

CodePudding user response:

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

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

BKcv.ItemsSource = items;
 
  • Related