如何导航到Windows应用商店应用中的网格应用(XAML)模板中的其他页面? [英] How to navigate to other Pages in Grid App (XAML) Template in Windows Store Apps?

查看:104
本文介绍了如何导航到Windows应用商店应用中的网格应用(XAML)模板中的其他页面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Windows应用商店应用的初学者。我正在尝试创建一个应用程序,其中第一页将是网格应用程序页面,但在点击项目而不是显示其内容时,它应该导航到其他页面。我应该在哪里设置链接?



提前致谢。 :)

I am a beginner to Windows Store Apps. I am trying to create an app where first page will be a Grid App Page but on clicking on an item instead of displaying its content it should navigate to some other page. Where should I set link for it?

Thanks in advance. :)

推荐答案

如果项目是使用网格应用程序模板创建的,则加载的页面是GroupedItemsPage。要在项目单击时更改导航页面,请转到代码隐藏文件中项目的单击事件...它可能是这样的



< b> C#

If the project is created using Grid App template, the page that gets loaded is "GroupedItemsPage". In order to change the navigation page on item click, go to the click event of the item in code-behind file...it could be something like this

C#
void ItemView_ItemClick(object sender, ItemClickEventArgs e)
        {
            // Navigate to the appropriate destination page, configuring the new page
            // by passing required information as a navigation parameter
            var itemId = ((SampleDataItem)e.ClickedItem).UniqueId;
            this.Frame.Navigate(typeof(ItemDetailPage), itemId);
        }



所以在这里你可以改变你需要的页面并传递所需的参数


so here you can change the page you need and pass required params

this.Frame.Navigate(typeof(YourNewPage));







VB:






VB:

Private Sub ItemView_ItemClick(sender As Object, e As ItemClickEventArgs)

       ' Navigate to the appropriate destination page, configuring the new page
       ' by passing required information as a navigation parameter
       Dim itemId As String = DirectCast(e.ClickedItem, Data.SampleDataItem).UniqueId
       Me.Frame.Navigate(GetType(ItemDetailPage), itemId)
   End Sub



所以在这里你可以更改您需要的页面并传递所需的参数


so here you can change the page you need and pass required params

Me.Frame.Navigate(GetType(YourNewPage))


这篇关于如何导航到Windows应用商店应用中的网格应用(XAML)模板中的其他页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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