How can I set an ItemTemplate to a StackLayout? It works fine for a simpler variation using only TextCell. With StackLayout, it throws an exception. I think the issue is Databinding. I'm unsure of how to do it.
ListView L = new ListView()
{
ItemsSource = { some legit stuff that's working fine },
ItemTemplate = new DataTemplate(() => new A()) // works fine for TextCell but not StackLayout
};
class A : StackLayout
{
public A()
{
Label labelName = new Label();
labelName.SetBinding(Label.TextProperty, "Name");
Label labelDescription = new Label();
labelDescription.SetBinding(Label.TextProperty, "Description");
Children.Add(labelName);
Children.Add(labelDescription);
}
}