【发布时间】:2014-11-21 11:24:16
【问题描述】:
在从 Web 获取图像后,我遇到了 Xamarin 表单应用程序在 Android 中崩溃的问题。如果我使用此代码,一切正常:
Image myImage = new Image
{
Source = ImageSource.FromUri(new Uri(myObj.ImagePath1)),
};
当我使用图像单元格的自定义渲染器获取列表视图的图像时,很快就会崩溃。
这是我的带有数据绑定的列表视图的代码
listView.ItemTemplate = new DataTemplate
(typeof(MyImageCell))
Bindings = {
{TextCell.TextProperty,
new Binding("MyTitle")},
{TextCell.DetailProperty,
new Binding("MyAddress")},
{ImageCell.ImageSourceProperty,
new Binding("MyURL")},
}
};
我是 C# 和 Xamarin 的新手,我不知道如何像第一个示例一样声明它并且仍然在绑定代码中使用它。我尝试了许多不同的方法,但似乎没有任何效果。希望我缺少一些简单的东西。
干杯
【问题讨论】:
标签: c# data-binding xamarin.forms imagesource