C# 获取ListView Xamarin表单中的条目值
我是Xamarin形式的新手。当我点击标签“OK”时,我试图捕获ListView中的所有C# 获取ListView Xamarin表单中的条目值,c#,.net,xamarin.forms,C#,.net,Xamarin.forms,我是Xamarin形式的新手。当我点击标签“OK”时,我试图捕获ListView中的所有条目值 以下是我的ListView XAML代码: 这是我的C#代码: 如果您有更好的解决方案,我将采取,提前感谢。首先,您需要将Entry的值绑定到模型中的属性 <Entry Placeholder="Your traduction" Text="{Binding Entryreponse}" ... /> 非常感谢,我如何更改标签的值项目“ValueAnswer”只需更新属性,如果您的模
条目值
以下是我的ListView XAML代码:
这是我的C#代码:
如果您有更好的解决方案,我将采取,提前感谢。首先,您需要将Entry的值绑定到模型中的属性
<Entry Placeholder="Your traduction" Text="{Binding Entryreponse}" ... />
非常感谢,我如何更改标签的值项目“ValueAnswer”只需更新属性,如果您的模型实现InotifyProperty更改,它将自动为您更新UI如果将条目和标签绑定到同一属性会更简单对于我的级别,我真的不想这样做您的意思是:
public void OnResultTest(object sender, EventArgs args)
{
foreach (var item in TestList.ItemsSource)
{
// cast the item
var dataItem = (TestModel)item;
Console.WriteLine( dataItem.Entryreponse); //output : "put some text here"
}
}
<Entry Placeholder="Your traduction" Text="{Binding Entryreponse}" ... />
foreach (var item in ListWordsTest)
{
Console.WriteLine(item.Entryreponse);
}