我想在信息窗口点击时从一个页面导航到另一个页面,我有一个自定义地图渲染器。任何人都可以建议我如何从自定义渲染器导航到其他视图。在此先感谢:)
答案 0 :(得分:2)
你真的想让Android项目和PCL分离,所以我会使用MessagingService从Android项目发送一条消息,然后由PCL接收。
<强> YourCustomRenderer:强>
MessagingService.Current.SendMessage("NavigateMessage", new NavigationParamsModel
{
TargetPage = "DetailsPage",
Id = 12,
SomethingElse = "blahblah"
});
<强> PCL:强>
MessagingService.Current.Subscribe<NavigationParamsModel>("NavigateMessage", async (arg1, arg2) =>
{
// Just an example of how this would be done using Prism.Navigation.
// Pure Xamarin.Forms navigation is obviously different.
_navigationService.NavigateAsync(arg2.TargetPage);
});