Is there a way to know when the panorama view gets changed from say a current title "Settings" to "Help"? I need this so I know what view to open if they click the add button or remove appbar buttons.
So lets say we got a panerama view like:
How can we know when the user changed from the recent part to the part the phone is currently on or the network part?
The Panorama control raises a SelectionChanged event each time the user navigates from one PanoramaItem to the next. You can then determine the index of the current page by inspecting the SelectedIndex property.
PanoramaControl has a property called SelectedIndex, which gives the index of the currently selected PanoramaItem. By this index you can decide which page has been selected.
Related
I have a ListView and I have it behaving exactly as I want, I'm displaying check boxes and I'm only able to select a single item at a time. Now the problem is this is bad UX- it shouldn't use check boxes when only 1 selection at a time is allowed, it should use radio buttons. So I need to replace the checkboxes with radio buttons. I think the easiest way would be to preempt the drawing of the checkbox and replace it with a radio button glyph, but I'm not really sure how to get started there. Also, it needs to work on a ListView, not a ListBox, and it needs to work in WinForms, not ASP or WPF. I would really appreciate information on how you know this as well- if you can link to documentation/code that shows how drawing works for the ListView in particular that would be wonderful. I have found the docs for .NET 4.8 here and am perusing that now, but details would still be appreciated.
So my question in brief is, "How can I subclass a ListView (Not ListBox) to use radio buttons rather than checkboxes?"
If the ListView.CheckBoxes property is true, you could use the ListView.StateImageList property as a source for images of checked/unchecked items.
Remarks section says:
The StateImageList property allows you to specify an ImageList that contains images to use to represent an application-specific state of an item in a ListView control. State images are displayed to the left of an icon for the item. You can use state images, such as checked and unchecked check boxes, to indicate application-defined item states. State images are visible in all views of the ListView control.
If an ImageList is specified in the StateImageList property and the CheckBoxes property is set to true, the images at index positions 0 and 1 in the ImageList are displayed instead of the check box. The image at index position 0 is displayed instead of the unchecked check box, and the image at index position 1 is displayed instead of the checked check box.
Windows phone 7.5 and above.
I wanna add a button at the bottom of the list, so the user can click it to fetch more articles.
I put a button inside a listbox in xaml. But it does not work, when the itemsource of the listbox get binded at the runtime, the button disappear.
how to approach the goal?
One solution is to implement that as part of your binding to set the last item to display 'load more...'.
For example, if your listbox template shows a picture, a header and then some description text and you retrieve 25 items each time. What you can do is grab those 25 items from your source then manually add an item with header 'load more...' then bind that list. You can then easily check if the 'load more...' item was clicked by checking the header text or if your model has some unique identifiers for each item then you can give the 'load more...' item an id of -1 or some other unique value.
The other solution is to automatically detect when the users scroll to the end (or near the end) of your list box then automatically load more data. Check these tutorials on how to implement this:
Loading Data when the User Scrolls to the End of a List in Windows Phone 7
Detect when a ListBox scrolls to its end (WP7)
WP7 – How To Extend ListBox When Reaching Last Item
I had few reading about how to navigate between pages and using the back button.
What I try to do actually is implementing one of my button on the tap event to go back to the previous list box items.
I mean, I bind folders on my listbox. When I click on an item I load the subfolders so the itemssource is changing.
How can I , when i click on the back button, display the previous itemsource of the listbox ?
Should I use history ? Everything is on the same page, so i definitly can't use this navigate method .
You could hook into the OnBackKeyPress method and alter the ItemsSource, you need to make sure that you can exit your application sucessfully if you went down this route :-
http://msdn.microsoft.com/en-us/library/microsoft.phone.controls.phoneapplicationpage.onbackkeypress(v=vs.92).aspx
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.
I am trying to use the 'best practice' technique of using the
FocusManager.GetFocusedElement()
in the OnNavigatedFrom event and
this.FindName
to locate the focused control in the OnNavigatedTo event.
I have a Panorama page and within each PanoramaItem I have a user control which in turn have many controls such as TextBox's etc..
The GetFocusedElement does retrieve the focused controls name in the user controls, but the FindName method then fails to find it on return! The name returned does not include any reference to the user control itself, so I am assuming the FindName does not traverse user controls!
Am I doing something wrong or does anyone know a way of easily improving this, or at least a simple technique for at least showing or navigating too the last PanoramaItem that was displayed before the app is deactivated?
To set the selected panorama item when the page is navigated to use the DefaultItem property.
To determine what this should be, save the SelectedItem when navigating away from the page.
You should be doing this at the page level and accessing properties of the panorama. There should be no need to do anything in the controls hosted in a panoramaItem whether they are user controls or not.
If you wish to avoid the side effects of altering the defaultItem, you may want to have a look at http://blogs.ugidotnet.org/corrado/archive/2010/09/27/smartpanorama-a-panorama-control-extension.aspx