Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

ListView binding array in class

$
0
0

My object:

    public class ListData 
    {
    public string DisplayName { get; set; }
    public ListInfo[] info { get; set; }
    }
    public class ListInfo
    {
    public string DisplayTag { get; set; }
    }

My data:

    var li = new ListInfo()
    {
    DisplayTag = "Tag"
    };

    var listView = new ListView();
    listView.ItemsSource = new[]
    {
    new ListData { DisplayName = "One" },
    new ListData { DisplayName = "Two",  info = new[]{ li, li} }
    };

I customize ListView and set binding:

    displayNameLabel.SetBinding(Label.TextProperty, "DisplayName");
    displayTagLabel.SetBinding(Label.TextProperty, new Binding("info[0].DisplayTag"));

But info[0].DisplayTag not work. And how display all array object ListInfo with Binding?


Viewing all articles
Browse latest Browse all 58056

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>