Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1 +1,49 @@
**[View document in Syncfusion .NET MAUI Knowledge Base](https://www.syncfusion.com/kb/13090/how-to-apply-the-item-text-color-in-net-maui-listview-sflistview)**

## Sample

```xaml
<ContentPage.Resources>
<ResourceDictionary>
<local:ColorConverter x:Key="ColorConverter"/>
</ResourceDictionary>
</ContentPage.Resources>

<syncfusion:SfListView x:Name="listView" ItemSize="60" ItemsSource="{Binding ContactsInfo}">
<syncfusion:SfListView.ItemTemplate >
<DataTemplate>
<code>
. . .
. . .
<code>
</DataTemplate>
</syncfusion:SfListView.ItemTemplate>
</syncfusion:SfListView>

C#:

public class ColorConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value == null)
return false;
var itemdata = value as Contacts;
if (itemdata.ContactType == "HOME")
return Colors.RoyalBlue;
else if (itemdata.ContactType == "WORK")
return Colors.PaleGreen;
else if (itemdata.ContactType == "MOBILE")
return Colors.HotPink;
else if (itemdata.ContactType == "OTHER")
return Colors.DarkGoldenrod;
else
return Colors.BlueViolet;
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
```