问题描述
我的用例要求用户从他的设备库中选择多张照片,并将所选图像显示为我的 xamarin 表单应用程序中的网格视图。我已经使用设备相机完成了拍照并显示在应用程序上拍摄的照片,但这一次只是一张照片。拍照代码如下。
public async void DoTakePhoto()
{
try
{
VisualState = State.Loading;
await CrossMedia.Current.Initialize();
if (!CrossMedia.Current.IsCameraAvailable || !CrossMedia.Current.IsTakePhotoSupported)
{
return;
}
MediaFile file = await CrossMedia.Current.TakePhotoAsync(new Plugin.Media.Abstractions.StoreCameraMediaOptions
{
SavetoAlbum = true,Directory = "App Photo Folder",MaxWidthHeight = 2048,CompressionQuality = 50,PhotoSize = PhotoSize.MaxWidthHeight,});
if (file == null && ImageSource == null)
{
return;
}
else if (file == null)
{
return;
}
MediawithFile = new MediumWithFile(m_ExifDataParser) {
Id = new Guid(),Data = file,Path = file.Path,AlbumPath = file.AlbumPath,Version = 1
};
}
catch (Exception ex)
{
displayAlert("B5",ex.ToString(),"B5");
return;
}
finally
{
VisualState = State.None;
}
}
public ImageSource ImageSource => MediawithFile?.Data == null ? null : ImageSource.FromFile(MediawithFile.Data.Path);
<Frame Grid.Row="0"
Grid.ColumnSpan="2"
Padding="0"
CornerRadius="8">
<Image Aspect="AspectFill"
BackgroundColor="Transparent"
Source="{Binding ImageSource}" />
</Frame>
有没有办法从图库上传多张图片并使用相同的跨媒体插件显示它们。对此的任何想法表示赞赏。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)