在父页面的代码隐藏中,我们怎么说,
foreach(label in the ListView)
{
if(label.Text == "something")
{
//do some formatting
}
}
我认为这应该是OnAppearing的覆盖,但我不确定语法。
感谢
更新: 在回复评论时,ListView有2个标签,我想说,如果label1 =" x",请在label2上进行特定格式化。
希望有点清楚
答案 0 :(得分:2)
ListView
中有一个名为TemplatedItems
的属性返回ViewCell
,我们可以从此ViewCell获取我们拥有的所有视图(如果您使用模板,可能会有点有点不同)。
foreach (ViewCell myViewCell in mylist.TemplatedItems)
{
Label myLabel = (Label) myViewCell.View;
if (myLabel.Text == "smth")
{
//do some formatting
}
}