我正在使用xamarin.forms并使用此代码从用户库中获取图像
protected async Task PickImage()
{
try
{
Stream stream = await DependencyService.Get<IPicturePicker>().GetImageStreamAsync();
//stream.GetType<Uri>();
if (stream != null)
{
Image image = new Image
{
Source = ImageSource.FromStream(() => stream),
BackgroundColor = Color.Gray
};
cadastrar_foto_perfil.Source = ImageSource.FromStream(() => stream);
}
if (Device.OS == TargetPlatform.iOS)
{
loginPage.RecriaCadastroIOS();
}
}
但是......现在我得到它正在放入一个图像,现在我需要从所选图像中获取URI ...有人知道如何使用该代码执行此操作吗?