Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/257.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 获取ListView Xamarin表单中的条目值_C#_.net_Xamarin.forms - Fatal编程技术网

C# 获取ListView Xamarin表单中的条目值

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”只需更新属性,如果您的模

我是Xamarin形式的新手。当我点击标签“OK”时,我试图捕获ListView中的所有
条目

以下是我的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);
}