Windows Phone 7, creating temporary pages with data?
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
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.
精彩评论