I am currently using FFImageLoading library on a listView inside the custom data template.
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<ViewCell.ContextActions>
<MenuItem Clicked="OnDelete" CommandParameter="{Binding .}" Text="Delete" IsDestructive="True" />
</ViewCell.ContextActions>
<StackLayout
Padding="12,10,12,10"
BackgroundColor="Transparent"
Orientation="Horizontal">
<Image
DownsampleToViewSize="true"
Aspect="AspectFit"
Source="{Binding FileThumbnail, Converter={StaticResource mimeTypeToImageConverter}}"
WidthRequest="60"
HeightRequest="60">
</Image>
Inside the mimeTypeToImageConverter:
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is string)
{
var file = (string)value;
if (FileUtilities.IsImageType(file))
{
//var fileImageSource = new FileImageSource();
//fileImageSource.File = file;
var imageSource = ImageSource.FromFile(file);
return imageSource;
}
else {
return ImageSource.FromFile("ic_file_white.png");
}
}
return null;
}
I used on android but android works fine. When I change back to Image control, the iOS will show the image.
I really need it to reduce the image size. Does any of you got that problem before.