【发布时间】:2020-04-17 09:13:00
【问题描述】:
我在绑定到 Xamarin 中的属性时遇到问题,并且由于某种原因无法使用 Microsoft 的文档来解决。
假设我有这个视图模型:
public class FooViewModel
{
public IEnumerable<string> Foos { get; set; }
public string SpecialFoo { get; set; }
}
我认为这是:
<StackLayout BindableLayout.ItemsSource="{Binding Foos}">
<BindableLayout.ItemTemplate>
<DataTemplate>
<Label Text="{Binding SpecialFoo}"/>
</DataTemplate>
</BindableLayout.ItemTemplate>
</StackLayout>
我遇到了在 DataTemplate 中无法绑定到 FooViewModel 中的属性的问题。如何将此绑定到 SpecialFoo?
【问题讨论】:
标签: c# xamarin xamarin.forms