Hi there,
I was hoping to implement a custom renderer for a HorizontalListView.
Ive added two properties to the HorizontalListView; ItemsSource and ItemTemplate.
In the customer renderer for this view I was hoping to be able to set the DataTemplate for a native ListBox control (windows phone)
I tried following custom renderer hoping that it would just work but unfortunately it doesn't seen to. Can you advise whether this should be possible (or not) and whether this is the right way to go about providing a Xamarin.Forms DataTemplate to a native control.
Thanks.
Stuart
public class HorizontalListViewRenderer : ViewRenderer
{
protected override void OnModelSet()
{
base.OnModelSet();
var model = Model as HorizontalListView;
var listBox = new ListBox();
listBox.ItemTemplate = new ViewCellRenderer().GetTemplate((Cell)model.ItemTemplate.CreateContent());
listBox.ItemsSource = model.ItemsSource;
Children.Add(listBox);
}
}