是否可以绑定到对象而不是列表视图中的属性。例如:
public ObservableCollection<Employee> employees = new ObservableCollection<Employee>();
public EmployeeListPage()
{
employees.Add(new Employee { DisplayName = "Rob Finnerty" });
employees.Add(new Employee { DisplayName = "Bill Wrestler" });
employees.Add(new Employee { DisplayName = "Dr. Geri-Beth Hooper" });
employees.Add(new Employee { DisplayName = "Dr. Keith Joyce-Purdy" });
employees.Add(new Employee { DisplayName = "Sheri Spruce" });
employees.Add(new Employee { DisplayName = "Burt Indybrick" });
}
<ListView ItemSource="{Binding employees}" x:Name="emView">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<b:CustomView Employee="{Binding .}"/>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>`