diff --git a/README.md b/README.md index e20b0d0..a10521d 100644 --- a/README.md +++ b/README.md @@ -1 +1,41 @@ **[View document in Syncfusion .NET MAUI Knowledge Base](https://www.syncfusion.com/kb/13165/how-to-apply-alternate-row-style-in-net-maui-listview-sflistview)** + +## Sample + +```xaml + + + + + + + + + + + . . . + . . . + + + + + + +C#: + +public class IndexToColorConverter : IValueConverter +{ + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + var listview = parameter as SfListView; + var index = listview.DataSource.DisplayItems.IndexOf(value); + + return index % 2 == 0 ? Colors.LightGray : Colors.Aquamarine; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } +} +```