我有一个列表,其中字符串是图像的 url。
我正在尝试动态创建图像网格,源是每个 url。
我尝试过绑定(bind),但它似乎不起作用。我也无法访问我在 Xaml 中创建的图像的 x:Name。我愿意在 Xaml 或后台代码中执行此操作。
关于如何做到这一点的任何想法。
最佳答案
//imageList is a List<string> with your image urls in it
foreach(var i in imageList) {
Image image = new Image();
image.Source = ImageSource.FromUri(new Uri(i));
// you will need to add logic to calculate the Row/Column for each image
myGrid.Children.Add(image,x,y);
}
关于c# - Xamarin Forms XAML - 无法从 URL 列表创建多个图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45121717/