In my application client had a requirement that. When the user shakes the phone he/she should navigate in to the home page. So writing the shake event handler in each page seems bit difficult. Is there any way present to handle this event in a single page like app.xaml, if any one go through similar situation and found a solution please help me too for achieving the functionality
For shake detection you should use accelerometer like described in this article. For presenting it to all pages, you could use
RootFrame
property in your app.xaml.cs and call it's Navigate property when the shake is detected.
Related
I'm creating an app that has start button which brings you to start page from anywhere in app.
However back navigation stack hurts when I just navigate to start page.
Looking for solution I found NonLinearNavigationService. The trouble is that download links are target to app hub, which (now, as we have new better app hub) redirects me to main page and nowhere further. Also I failed to find it on app hub using build in search engine.
Anyone knows where from can I get it?
Or maybe another solution for navigation loops?
If you use RemoveBackEntry(), the entries are programmatically cleared from the backstack so you don't have to deal with the side effects of actually navigating back through the pages to pop them off the stack.
The NonLinear Navigation Service effectively does what you have tried. It calls GoBack() to traverse back up the stack. What it additionally does to prevent the flicker is to make the root frame transparent. See this question:
Skip a page when the back button is pressed, WP7
I don't want to call your question a duplicate because I think before Mango came out, that was probably the solution that needed to be used. Now that RemoveBackEntry() has been added to NavigationService, I think using that would probably be the better approach.
No linear navigation in WP7 is generally not recommended, because of the hardware back button and the UX on the rest of the phone, so you should probably structure your app to avoid this. However it should pass the certification process.
Here's another similar question In-App Home Button to Navigate to MainPage allowed? and an article about circular navigation which mentions the NonLinearNavigationService you are talking about http://windowsteamblog.com/windows_phone/b/wpdev/archive/2010/12/13/solving-circular-navigation-in-windows-phone-silverlight-applications.aspx.
If the only non-linear part of the navigation is the home button, you could use NavigationService.RemoveBackEntry() in a loop untill it raises an InvalidOperationException in the home button event. When the InvalidOperationException is raised the BackStack is empty and the next click on the back button exits the application.
You all know the Windows Phone backstack right. If you go through some apps, tap the Home key after starting each app. Now tap and hold the Backkey to see the Backstack. You can now see some small images of your apps, and can pick which one to go to right.
Question:
Is it possible to intercept before the backstack image is created? I have tried to blur my page in various events (include OnNavigatingFrom) to no avail.
My guess is some other event (probably something we don't have access to) is triggered and a bitmap is created, because when you use the Backstack to navigate you can just see a slight transition from the saved image to a real page IMO.
Does anyone know if its possible to intercept or manipulate these images on the backstack?
Example screenshot from WP emulator of the Backstack thumbnails
Following my comment, I've just tried this:
Set a breakpoint anywhere in the code
Start the app with the debugger attached, then let it reach the breakpoint
While the execution is stopped by the debugger, long press on the back button
The task switching UI is displayed even though the managed code execution is stopped
From there, I think we can safely conclude that the task switching and the thumbnail are handled entirely by native code. Therefore, there's nothing you can do.
I recently wrote a blogpost in which I discuss the ways I tried to hide data from the application snapshot. (You can read it here: http://corstianboerman.com/trying-to-hide-crucial-data-from-an-application-snapshot/)
The outcome: You just can't hide it.
I am trying to automate testing of WP7 apps. In my app, one functionality is CALL; ie; the page changes to WP's phone call page. While testing I want it to automatically come back from the phone call page to simulate a "back" press. I know we can use navigation service to perform back - press however I want to use the back-press on a different page which is not under my control(ie; default phone call page). Is there any way of achieving this?
NO, Current that is not supported in the WP7.
Even if any hacks make it possible also, your application doesn't meet the certification requirements.
So no point, in making this.
I have a strange problem with a Windows Phone (7.1/Mango) app.
My understanding is if NavigationService.GoBack() is called on the initial page of an app, then the app should exit. This happens when the user presses the phone's back button, but it does not happen if there's a UI button with the same functionality (because NavigationServive.CanGoBack returns false).
Is this intentional or am I missing something? I haven't messed around with redirecting the initial navigation or anything like that, so I can't account for this difference in functionality.
I know the answer is simply "don't have a UI back button", which is very true, but does anyone know why this happens?
Thanks in advance!
I believe this is because the navigation service is "scoped" to your application. This allows you to deduce a bit more about how the user is using your app.
For instance if CanGoBack is false then this is the first page the user is visiting. This is useful if you're using deep links into your app (from reminders or toast messages) because you may need to act differently on the deep link as opposed to a normal navigation to the page.
I am new to windows phone (WP7) and to me it looks like everything on WP7 is about pages. I want a small window to pop up from the bottom of a page while staying on the same page. The small window will have some controls (like slider, list etc.). It should not behave like a modal dialog box though, i.e. the rest of the page (which is not covered by the small window) should still be active and user should be able to do something there. And I want to have a separate C# class which will handle the events from the controls on the small window.
This is very easy on iPhone, using view controllers, is there something similar on windows phone?
It sounds that it would make sense to make your "pop up" part of the page with the content it is intended to manipulate content on that page. If you want to encapsulate the functionality of the "pop up" you could make it a UserControl. If you went this route then animating it to slide onto the screen will be straightforward.
Windows Phone 7 typically uses an MVVM model compared to iPhone's MVC one for app structure. The direct comparison therefore isn't appropriate. WP7 also uses a very different design language to that of the iPhone and so a straight port of application design and layout is also unlikely to create a great experience on WP7.
I'd recommend taking some time to understanding the differences in the platforms and how your existing design would be best suited to recreation on WP7. Not only will this help you create a better experience on WP7 but enable to see if this your question actually relates to something you should be doing or not.
This very much sounds like something that goes against the nature of the platform, and the general design guidelines.
If you're providing some available configuration options to the user, you should do it on a separate page, so the user can change the settings there, approve it, and then be navigated back to the previous page.
However, if you really want to, you're talking about displaying a UserControl inside a Popup. But it wouldn't be a very good user experience, and confuse most users, as it doesn't follow the same look&feel as the rest of the platform.