首页 > 解决方案 > 在 Xamarin Forms 中绑定之前修改数据

问题描述

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

  1. Tb_Country
  2. Tb_Region

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

标签: androidrestxamarinxamarin.forms

解决方案


也许您需要 ListView 中的 DataTemplate?

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

资源


推荐阅读