Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/283.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
c#Windows Phone中带绑定的可观察收集_C#_Xaml_Binding_Windows Phone_Observablecollection - Fatal编程技术网

c#Windows Phone中带绑定的可观察收集

c#Windows Phone中带绑定的可观察收集,c#,xaml,binding,windows-phone,observablecollection,C#,Xaml,Binding,Windows Phone,Observablecollection,如何使此列表与listbox绑定?我可以得到我想要的数据,因为当我放置一个断点时,我看到它被正确加载。我听说他们有一个可观的收集,但不知道如何使用,然后不绑定xaml private void DownLoadCompleted(object sender, HtmlDocumentLoadCompleted e) { _popVideos = new List<PopularVideos>(); var data =

如何使此列表与listbox绑定?我可以得到我想要的数据,因为当我放置一个断点时,我看到它被正确加载。我听说他们有一个可观的收集,但不知道如何使用,然后不绑定xaml

 private void DownLoadCompleted(object sender, HtmlDocumentLoadCompleted e)
        {
            _popVideos = new List<PopularVideos>();
            var data = e.Document.DocumentNode.SelectSingleNode("//div[@class='content']")
               .Descendants("img")
               .Select(img => new
               {
                   Title = img.Attributes["alt"].Value,
                   Url = img.Attributes["src"].Value,
               }).ToList();

            foreach (var item in data)
            {               
                PopularVideos pop = new PopularVideos(item.Title, item.Url);
                _popVideos.Add(new PopularVideos(item.Title, item.Url));
            }

            listBoxPopular.ItemsSource = _popVideos;
        }

正如我在中提到的,有一篇介绍数据绑定的文章,您应该通过它来了解。

一篇介绍性文章并没有包含我所需要的一切,所以我再次询问。第一个想法-使类成为PopularVideos=>public类PopularVideos@jimpanzer把它放进去,一直不工作。
class PopularVideos
    {
        public PopularVideos() { }
        public PopularVideos(string titulo, string url)
        {
            Titulo = titulo;            
            BitmapImage Img = new BitmapImage(new Uri(url));
        }

        public string Titulo { get; set; }

        public Uri Url { get; set; }
    }