【发布时间】:2017-02-05 22:52:34
【问题描述】:
我有一个项目类,其中包含存储在 SQLite 数据库中的名称和价格值。我在 Listview 中显示它们,其中名称为 Label,价格为 Entry。
<ListView x:Name="itemListView">
<DataTemplate>
<ViewCell>
<StackLayout Orientation="Horizontal" HorizontalOptions="FillAndExpand">
<Label Text="{Binding name}"/>
<Entry Text="{Binding Path=price, Mode=TwoWay, StringFormat='{}{0:c}'}" Keyboard="Numeric" Completed="updateItem" />
</StackLayout>
</ViewCell>
</DataTemplate>
</ListView>
我想这样当条目更改完成时,它将使用新的价格值更新 SQLite 数据库中的项目,但是,我不知道如何从 Listview 中检索已完成的项目。我想我需要使用下面的方法,但我不知道该放什么。
async void updateItem(object sender, EventArgs e)
{
//Code to update the item with the SQLite database with the new price
}
【问题讨论】:
标签: c# xaml xamarin.forms xamarin.forms.listview