通过xamarin表单中的绑定上下文传递图像

通过xamarin表单中的绑定上下文传递图像,xamarin,xamarin.forms,Xamarin,Xamarin.forms,我想要的是通过bindingcontext将一个图像传递到另一个页面 这是图像已经绑定的页面,当点击它时,我想把它带到另一个页面 <Image Source="{Binding Image}" x:Name="image1" HeightRequest="200" WidthRequest="200" IsEnabled="True" Aspect="Fill" Margin="10"> <Image.GestureRec

我想要的是通过bindingcontext将一个图像传递到另一个页面

这是图像已经绑定的页面,当点击它时,我想把它带到另一个页面

<Image Source="{Binding Image}"
    x:Name="image1"
    HeightRequest="200"
    WidthRequest="200"
    IsEnabled="True"
    Aspect="Fill"
    Margin="10">
    <Image.GestureRecognizers>
        <TapGestureRecognizer 
            Tapped="TapGestureRecognizer_Tapped" 
            NumberOfTapsRequired="1"/>
    </Image.GestureRecognizers>
</Image>
这是拍摄图像的第二页的代码

 <Image Source="{Binding Image}" Aspect="Fill"/>
 <Image Source="{Binding .}" Aspect="Fill"/>
问题是图像没有显示第二页。代码有什么问题?

回答 根据您的代码,您已将第二页与第一页的图像源绑定。所以,您的第二个页面绑定上下文是图像源。因此,您可以按照我的解决方案使用它

解决方案 这是拍摄图像的第二页的代码

 <Image Source="{Binding Image}" Aspect="Fill"/>
 <Image Source="{Binding .}" Aspect="Fill"/>
完美解 在第二页viewmodel中为图像源(如ImageSource)创建新属性,并从第一页分配它,然后在第二页上使用此属性,如下所示:

<Image Source="{Binding ImageSource}" Aspect="Fill"/>