Last active
March 17, 2022 22:53
-
-
Save aybarsyalcin/0aed32e43d8cc2d17d42da5bb9107227 to your computer and use it in GitHub Desktop.
Xamarin.Forms Get All Cell on Listview
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
IEnumerable<PropertyInfo> pInfos = (xListView as ItemsView<Cell>).GetType().GetRuntimeProperties(); | |
var templatedItems = pInfos.FirstOrDefault(info => info.Name == "TemplatedItems"); | |
if (templatedItems != null) | |
{ | |
var cells = templatedItems.GetValue(xListView); | |
Xamarin.Forms.ITemplatedItemsList<Xamarin.Forms.Cell> listCell = cells as Xamarin.Forms.ITemplatedItemsList<Xamarin.Forms.Cell>; | |
ViewCell currentCell = listCell[position] as ViewCell; | |
currentCell.View.BackgroundColor = Color.White; | |
foreach (ViewCell cell in cells as Xamarin.Forms.ITemplatedItemsList<Xamarin.Forms.Cell>) | |
{ | |
if (cell.BindingContext != null && currentCell != cell) | |
{ | |
cell.View.BackgroundColor = Color.Transparent; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment