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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Text Color change

Thread ID:

Created:

Updated:

Platform:

Replies:

149556 Nov 29,2019 03:36 PM UTC Dec 12,2019 06:22 AM UTC Xamarin.Forms 3
loading
Tags: SfListView
Taahir
Asked On November 29, 2019 03:36 PM UTC

Hi,

Ive been trying to get the text color of items in a listView to change but for the life of me cannot figure out what I'm doing wrong. 

My code is as follows:


Im reading the items from itemSource and displaying them in the UI but I cant seem to edit them. I know in xaml all that has to be done is to create a label inside of a data template but currently my itemSource is just a list of strings.  Please assist me as I'm drawing a blank on how to proceed.


Gnana Priya Namasivayam [Syncfusion]
Replied On December 2, 2019 11:58 AM UTC

Hi Taahir, 
 
Thanks for contacting Syncfusion support. 
 
We would like to inform that you can only change Label’s TextColor property by binding the Model properties like string, color and ItemsSource property to ListView’s ItemTemplates like following. 
 
We have attached the code snippet and sample for your reference, please find from following link. 
 
 
private void ListView_ItemTapped(object sender, Syncfusion.ListView.XForms.ItemTappedEventArgs e) 
{ 
   var item = e.ItemData as TaskInfo; 
   if(item.LabelTextColor == Color.Red) 
       item.LabelTextColor = Color.DarkGreen; 
   else 
       item.LabelTextColor = Color.Red; 
} 
 
 
 
 
Regards, 
Gnana Priya N 


Taahir
Replied On December 11, 2019 10:30 AM UTC

Hi,

Thank you for your reply. It was extremely helpful. 

Kind Regards
Taahir.

Gnana Priya Namasivayam [Syncfusion]
Replied On December 12, 2019 06:22 AM UTC

Hi  Taahir, 
 
We are glad that reported issue has been resolved on your side. Please let us know if you any further assistance from us. 
 
Regards, 
Gnana Priya N 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

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

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
Live Chat Icon