We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to change the ListView selected item text color in Xamarin.Forms (SfListView)

Platform: Xamarin.Forms |
Control: SfListView

In Xamarin.Forms ListView, you can change the text color of selected item by using SelectionChanging event.


TextColor updated in SelectionChanging event, based on selection added or removed.

public class Behavior : Behavior<SfListView>
    SfListView listView;
    protected override void OnAttachedTo(SfListView bindable)
        listView = bindable;
        listView.SelectionChanging += ListView_SelectionChanging;
    private void ListView_SelectionChanging(object sender, ItemSelectionChangingEventArgs e)
        if (listView.SelectionMode == Syncfusion.ListView.XForms.SelectionMode.Single)
            if (e.AddedItems.Count > 0)
                var item = e.AddedItems[0] as Contacts;
                item.LabelTextColor = Color.Red;
            if (e.RemovedItems.Count > 0)
                var item = e.RemovedItems[0] as Contacts;
                item.LabelTextColor = Color.Black;
    protected override void OnDetachingFrom(SfListView bindable)
        listView.SelectionChanging -= ListView_SelectionChanging;


LabelTextColor bound to the Label added to SfListView in the ItemTemplate and Behaviour.

<syncfusion:SfListView x:Name="listView" ItemSpacing="1" SelectionMode="Single"
                        SelectionBackgroundColor="LightGray" AutoFitMode="Height" 
                        ItemsSource="{Binding contactsinfo}">
    <syncfusion:SfListView.ItemTemplate >
                    <Grid x:Name="grid" RowSpacing="0">
                            <RowDefinition Height="*" />
                            <RowDefinition Height="1" />
                        <Grid RowSpacing="0">
                                <ColumnDefinition Width="70" />
                                <ColumnDefinition Width="*" />
                                <ColumnDefinition Width="Auto" />
                            <Image Source="{Binding ContactImage}"
                                    HeightRequest="50" WidthRequest="50"/>
                            <Grid Grid.Column="1" RowSpacing="1" Padding="10,0,0,0" VerticalOptions="Center">
                                    <RowDefinition Height="*" />
                                    <RowDefinition Height="*" />
                                <Label LineBreakMode="NoWrap"  Text="{Binding ContactName}" 
                                        TextColor="{Binding LabelTextColor}"/>
                                <Label Grid.Row="1" Grid.Column="0"
                                        TextColor="{Binding LabelTextColor}"
                                        LineBreakMode="NoWrap" Text="{Binding ContactNumber}"/>


Change ListView Item color

View sample in GitHub

2X faster development

The ultimate Xamarin UI toolkit to boost your development speed.
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile