如何刷新导航上的最后一个 ContentPage [英] How to refresh the one but last ContentPage on the Navigation
本文介绍了如何刷新导航上的最后一个 ContentPage的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
通常,使用 NavigationStack 中的它来弹出当前页面:
Typically, one pops the current page using this from the NavigationStack:
Navigation.PopAsync( true );
如何使用Navigation
重绘当前页面之前的页面?
How to I use Navigation
to redraw the page just before the current page?
背景:当前页面更改了需要在最后一页中重新呈现的内容.
Background: The current page changed something that need to get re-presented in the one but last page.
推荐答案
我假设您使用的数据模型是不可观察/可绑定的,因此页面不是自动更新"的..
您可以使用 MessagingCenter
发布刷新事件"以避免将两个 Page
与事件耦合...
You could use MessagingCenter
to publish a "Refresh Event" to avoid coupling the two Page
s with events...
在您的主页中:
MessagingCenter.Subscribe<MainPage> (this, "RefreshMainPage", (sender) => {
// Call your main page refresh method
});
在你的第二页:
MessagingCenter.Send<MainPage> (this, "RefreshMainPage");
Navigation.PopAsync( true );
https://developer.xamarin.com/guides/xamarin-forms/消息中心/
这篇关于如何刷新导航上的最后一个 ContentPage的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文