Answers for "xamarin listview alternating row color"

0

xamarin listview alternating row color

public class AlternatingListView : ListView
{
    public AlternatingListView(ListViewCachingStrategy cachingStrategy) : base(cachingStrategy)
    { 
    }

    protected override void SetupContent(Cell content, int index)
    {
        base.SetupContent(content, index);

        var viewCell = content as ViewCell;
        viewCell.View.BackgroundColor = index % 2 == 0 ? Color.Blue : Color.Red;
    }     
}
Posted by: Guest on April-26-2022

Browse Popular Code Answers by Language