简体   繁体   English

WP7片段错误

[英]WP7 fragment error

For a Windows Phone 7 app, I have created an application bar which is common for all my pages and is defined inside App.xaml 对于Windows Phone 7应用程序,我创建了一个应用程序栏,该栏对于我所有页面均通用,并在App.xaml中定义

For eg. 例如。 the buttons are Home, Help, About Now, when I start my application, the default page is Home.xaml and the application bar is displayed. 按钮是“主页”,“帮助”,“关于现在”,当我启动我的应用程序时,默认页面是Home.xaml并显示应用程序栏。 When I click Help or About buttons, the navigation is performed using NavigationService and the corresponding page is displayed. 当我单击“帮助”或“关于”按钮时,将使用NavigationService执行导航,并显示相应的页面。 But, if I click Home button, an exception is thrown - No Fragment Support at this time. 但是,如果我单击“主页”按钮,则会引发异常-目前没有片段支持。

I found some suggestions where a unique querystring needs to be appended if you are trying to navigate to the same page. 我发现了一些建议,如果您尝试导航到同一页面,则需要在其中附加一个唯一的查询字符串。 Are there any other better solutions? 还有其他更好的解决方案吗?

Also, can anyone suggest any techniques to keep such code in one place so I don't have to repeat this logic on every page for which there is an app bar icon. 另外,任何人都可以建议任何技巧来将此类代码保存在一个地方,这样我就不必在每个带有应用程序栏图标的页面上重复此逻辑。

Pratik 普拉蒂克

Mark Chamberlain confirms you can't do this here . 马克•张伯伦(Mark Chamberlain)证实你在这里不能做得到。

Unique query string is the way around this. 唯一的查询字符串是解决此问题的方法。 Perhaps add something as a query that is an indication of what makes the next instance of this page different. 也许添加一些内容作为查询,以表明是什么使该页面的下一个实例与众不同。

Alternatively, you could just refresh the content in your page if that is applicable. 或者,您可以刷新页面中的内容(如果适用)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM