无法显示byteArray中的图像

时间:2018-03-30 16:42:51

标签: android xamarin

我无法显示表单字节数组中的图像。

xaml代码:

 <StackLayout VerticalOptions="FillAndExpand" Padding="20, 10" Spacing="10" >
        <Image Source="{Binding ScannedImage}"/>
 </StackLayout>

View Model:

public void HandleImagereceived(object sender, byte[] byteImage)
{
           var image = ImageSource.FromStream(() => new MemoryStream(byteImage));
           ScannedImage = image
}

 public ImageSource ScannedImage
 {
        get { return scannedImage; }
        set
        {
           scannedImage = value;
           OnPropertyChanged("ScannedImage");
        }
}

0 个答案:

没有答案