在 Xamarin Forms 中绑定之前修改数据

Posted

技术标签:

【中文标题】在 Xamarin Forms 中绑定之前修改数据【英文标题】:Modify data beafore binding in Xamarin Forms 【发布时间】:2021-12-17 21:18:06 【问题描述】:

我是 Xamarin Forms 的新手。我正在从我的 Web 服务器数据库将数据绑定到 ListView。我的网络服务器中有 2 个表。

    Tb_Country Tb_Region

Tb_Region 表中有一个 country_id 列。我在我的 ListView 中显示区域列表。但我得到的只是 country_id。我还想显示 Tb_Country 的国家名称。 我该怎么做?

【问题讨论】:

请在发帖前阅读How to Ask。为了让我们帮助您,我们必须知道您在做什么,并且您还没有发布任何相关代码 【参考方案1】:

也许您需要 ListView 中的 DataTemplate?

<ListView x:Name="EmployeeView"
        ItemsSource="Binding Employees">
<ListView.ItemTemplate>
  <DataTemplate>
    <TextCell Text="Binding DisplayName" />
  </DataTemplate>
</ListView.ItemTemplate>

source

【讨论】:

以上是关于在 Xamarin Forms 中绑定之前修改数据的主要内容,如果未能解决你的问题,请参考以下文章