![](/img/trans.png)
[英]How can I get the text value of a label that is a child of a stacklayout which is a child of a Frame inside a listview item
[英]How can i remove views inside of StackLayout?
我有一个项目。 当我扫描条形码时; 它在stacklayout中添加标签。 但是当我扫描第二个时,它会保存第一个标签,然后也添加第二个。 我必须看到刚刚扫描的一个,而不是第一个。 那么如何删除第一个标签然后添加新标签?
for (int i = 0; i < count; i++)
{
kampanya.Children.Add(new Label
{
Text = $"{myCampaignList[i].Name}",
TextColor = Color.FromHex("#22223b"),
FontSize = 22
}); ;
它是我代码的一部分。 当我扫描它时,像这样添加新的 label。
在开始添加之前清除StackLayout
的所有子项:
kampanya.Children.Clear()
for (int i = 0; i < count; i++)
{
kampanya.Children.Add(new Label
{
Text = $"{myCampaignList[i].Name}",
TextColor = Color.FromHex("#22223b"),
FontSize = 22
});
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.