Forum Xamarin.Forms

Binding parent model collection to ListView itemssource displaying child datas in xaml

Hi
i want to bind my datas to the listview in a special way.
Let me explain my problem in a short way:
I have a Parent class (let name it to Parent) and 2 child class, let name them child1 and child2. I have a List (which contains child1 and child2 elements) and I binded in xaml listview itemssource. The child1 contains a string property called Name and child2 contains a string property called Title.
I want to show a label in the listview and binding to text property the Name or the Title depending on the List item child type.

Is this possible in xaml? Or the only solution if I don't want to make the full list in code behind to create 2 separated list? in xaml?

Best Answer

Sign In or Register to comment.