嘿,
我有一个用户可以搜索的项目列表。搜索结果显示在列表框中。每个
编辑:
我在我的
animal
对象都有一个指向独立存储中图像的路径。如何最快地将我的列表框项内的图像控件绑定到独立存储中的图像?我看到的示例往往显示来自互联网而不是独立存储的图像。如果我有大约10张图片,似乎会占用所有内存并崩溃。谢谢编辑:
我在我的
BitmapConverter
类(继承IValueConverter)中使用了这个。 public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
if (value !=null)
{
BitmapImage bitmapImage = new BitmapImage();
bitmapImage.SetSource(new MemoryStream((Byte[]) value));
return bitmapImage;
}
else
{
return null;
}
}
我在AppResource.xaml文件的顶部有以下内容:
<ImageApp_Converter:BitmapConverter x:Key="bmpConverter" />
In my style, within the AppResource.xaml file:
<Image HorizontalAlignment="Left" Margin="8,8,0,4" Width="160" Height="120" Source="{Binding Converter={StaticResource bmpConverter}}" />
我在我的BitmapConverter中设置了断点,但从未被调用。我以前从未使用过IValueConverter,所以任何帮助都将是很棒的。谢谢。