以编程方式在列表视图项中更改textColor [英] Change textColor in list view item programmatically

查看:58
本文介绍了以编程方式在列表视图项中更改textColor的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想做这样的事情:

 textLabel_inCell.TextColor = Color.Black;

但是Visual Studio显示错误:

"textLabel_inCell在当前上下文中不存在!"

如何以编程方式更改listView项的文本颜色? 请帮忙.... 谢谢大家!

解决方案

是的,textLabel确实不存在,因为没有单个textLabel,而在ListView中却有许多.

通常,这是通过数据绑定完成的:

How can I change text color of listView item programmatically? Please help.... Thanks everyone!

Yes, textLabel really doesn't exist as there is no single textLabel but rather many of them in the ListView.

In general this is done with data binding: https://docs.microsoft.com/en-us/xamarin/xamarin-forms/xaml/xaml-basics/data-binding-basics#bindings-and-collections

这篇关于以编程方式在列表视图项中更改textColor的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆