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

Binding a ListView

$
0
0

I'm trying to display the images returned from a Bing image search, and there's something not quite right somewhere. I was able to get it working with a single image, but this is my first time using a ListView. As far as I can tell the VM code is working ok - i.e. not getting any error messages - just not seeing anything in the UI. Here's the relevant code...

VIEW
ListView ImageList;
ImageList=new ListView{};
ImageList.SetBinding( ListView.ItemsSourceProperty,new Binding("ImageResults",source: vm) );
(ImageList added to UI stack)

VM
private List<ImageObject> _imageResults;
public List<ImageObject> ImageResults
{
get { return _imageResults;}
set {
if (_imageResults != value) {
_imageResults=value;
PropertyChanged?.Invoke(this,new PropertyChangedEventArgs("ImageResults"));
}
}
}

ImageResults=(List<ImageObject>) client.Images.SearchAsync(query: searchterm).Result.Value;

thanks,
Donald.


Viewing all articles
Browse latest Browse all 77050

Trending Articles



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