转到第一页在C#WPF [英] Go to first page in C# WPF

查看:178
本文介绍了转到第一页在C#WPF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在WPF使用导航服务。对于导航页面使用:

I am using navigation services in WPF. For navigating to page I use:

this.NavigationService.Navigate(new MyPage());

有关回去我使用:

this.NavigationService.GoBack();



但我怎么回去的第一页(Home键),而无需使用

But how do I go back to the first page (Home button) without using

this.NavigationService.Navigate(new FirstScreen());

由于我不希望创建新的第一页,就回去吧?
和我并不总是以相同的顺序打开新屏幕。

Because I do not wish to create new first page, just go back to it? And I don't always open new screens in the same order.

推荐答案

的一种方法是使用方法 RemoveBackEntry 直到只有留在后面的一个条目导航服务的堆栈。一旦有只有一个入口简单做 Navigation.GoBack()

One way could be to use method RemoveBackEntry until there is only a single entry left in the back stack of navigation service. Once there is only a single entry simple do Navigation.GoBack()

这篇关于转到第一页在C#WPF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆