Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

Set listview text color from model string

$
0
0

I'm trying to figure out how to apply a hex color to my listview items. I've been searching high and low and can't get this to work. My current error when trying to debug is: "Additional unparsable characters are at the end of the string." My "color" in model is a string which contains the hex. Does it not work like this? All help and suggestions are greatly appreciated. here is my code:

classList = new ListView()
{
ItemsSource = viewModelStart.Classes
};

                classList.ItemTemplate = new DataTemplate(typeof(TextCell));
                classList.ItemTemplate.SetBinding(TextCell.TextProperty, "class_name");
                classList.ItemTemplate.SetBinding(TextCell.DetailProperty, "start_time");
                classList.ItemTemplate.SetValue(TextCell.TextColorProperty, Color.FromHex("color"));

Viewing all articles
Browse latest Browse all 77050

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>