private void ViewCell_Tapped(object sender, System.EventArgs e) { if(lastCell!=null) lastCell.View.BackgroundColor = Color.Transparent; var viewCell = (ViewCell)sender; if (viewCell.View != null) { viewCell.View.BackgroundColor = Color.Red; lastCell = viewCell; } }
<ListView.ItemTemplate> <DataTemplate> <ViewCell Tapped="ViewCell_Tapped"> <Label Text="{Binding StudentName}" TextColor="Black" /> </ViewCell> </DataTemplate> </ListView.ItemTemplate>