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

Text Color change

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.


3 Replies

GP Gnana Priya Namasivayam Syncfusion Team 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 



TA Taahir December 11, 2019 10:30 AM UTC

Hi,

Thank you for your reply. It was extremely helpful. 

Kind Regards
Taahir.


GP Gnana Priya Namasivayam Syncfusion Team 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 


Loader.
Live Chat Icon For mobile
Up arrow icon