Windows Phone 7,创建带有数据的临时页面?
我的项目涉及带有全景项目的全景页面。在该全景项目中,有一个包含按钮堆栈面板的列表框。单击每个按钮时,它会打开一个新页面,其中包含与他们单击的按钮相关的信息。
现在我的问题是——这个列表框堆栈面板中有大约 100 个独特的按钮。
我是否必须为这些按钮浏览并创建 100 个页面?我担心这可能会对应用程序大小造成负担,但想知道是否有一种方法可以让我只能使用一页,并且所有按钮都引用该页面,但根据他们单击的按钮,将填充一页与具体信息。
这是可行的吗?如果可以的话,我可以指出它的教程方向吗?或者有人很好地提供一些代码来完成此任务?
真诚的,
汤姆
My project involves a panorama page with a panorama item. In that panorama item is a listbox containing a stackpanel of buttons. When each button is clicked, it opens up a new page with info pertaining to that button they clicked on.
Now my question is this -- I have about 100 unique buttons in this listbox stackpanel.
Do I have to go through and create 100 pages for these buttons? I am concerned that this might tax on the application size, but wanted to know if there was a way where I can only use 1 page, and all the buttons reference that page, but depending on the button they click that one page will be populated with the specific information.
Is this doable, and if so, could I be pointed in the direction of a tutorial for it or someone very nicely provide some code to accomplish this?
Sincerely,
Tom
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
创建 PanoramaItem 的实例并将其添加到 Panorama 对象的 Items 集合中。
由于您需要在代码中引用 Panorama 对象,因此您应该给它一个名称。 (您不必必须这样做,但这是最不麻烦的。)
如何将内容放入此 PanoramaItem 中是另一回事,对此我会想到几种方法,但更有趣的是如何将内容添加到 PanoramaItem 中。使这个新的 PanoramaItem 成为选定的项目。通过大量的调试和心痛快进:你不能。
使用 Pivot 控件和 PivotItem,您将能够将 Pivot 的 SelectedItem 设置为新创建的 PivotItem。
Create an instance of PanoramaItem and add it to the Items collection of your Panorama object.
Since you will need to refer to your Panorama object in code, you should give it a name. (You don't have to, but that's the least mucking about.)
How you get content into this PanoramaItem is another matter for which several approaches spring to mind, but more interesting is the question of how you cause this new PanoramaItem to be the selected item. Fast forward through much debugging and heartache: you can't.
Use a Pivot control and PivotItem and you will be able to set the SelectedItem of the Pivot to the freshly minted PivotItem.