简体   繁体   English

在 Xamarin Forms 中绑定前修改数据

[英]Modify data beafore binding in Xamarin Forms

I am new at Xamarin Forms.我是 Xamarin Forms 的新手。 I am binding data to ListView from my Web Server data base.我正在将数据从我的 Web 服务器数据库绑定到 ListView。 I have 2 table in my web server.我的网络服务器中有 2 个表。

  1. Tb_Country Tb_Country
  2. Tb_Region Tb_Region

There is a column country_id in the Tb_Region table. Tb_Region 表中有一个 country_id 列。 I am displaying region list in my ListView.我在 ListView 中显示区域列表。 But I am getting only country_id.但我只得到 country_id。 I want to display also country title from Tb_Country.我还想显示来自 Tb_Country 的国家/地区标题。 How can I do that?我怎样才能做到这一点?

Maybe you need a DataTemplate in the ListView?也许您需要在 ListView 中使用 DataTemplate?

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

source 来源

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM