I want to detect swipe in web browser control in C# using JavaScript. I want to add some JavaScript to my web content and then if swipe occurs, call a method that loads another web content in the same web browser control.
I would like some sample code or any other suggestion to do this.
Thanks in advance
You'll need to use something to detect the swipe in javascript. I've been recommended to use touch.js but haven't had a chance to try this yet.
When you detect the swipe you can call out to native code using window.external.notify().
Be sure to set IsScriptEnabled="True" on the WebBrowser control and register an handler for the ScriptNotify event.
It's this event handler which would load the new content.
First of all, consider that gestures for a webbrowser control have it's own handlers. Now, if you don't need to pan/zoom or the like in the webbrowser control, it's not a problem.
Then you simply set the IsHitTestEnabled attribute to false, so that the web-browser no longer receives input. Then you can simply use the GestureService from the Silverlight Toolkit to handle the swipe/flick inputs.
I wrote some code on how to handle this, in another question: wp7 horizontal swipe selection
Related
Is there any possibility to drop an external file onto a WebView in a Windows UWP app?
I know about :
AllowDrop="True" Drop="WebView_Drop" DragOver="WebView_DragOver"
I was able to copy files that i dragged into the clipboard and use it then on other items like displaying them as an image etc.
Besides that I don't see any way to interact directly with the webview or am i wrong? The current page the webview is showing is allowing to drop media files into it and i would like to use that feature in the webview...
WebView does not support drop event. WebView doesn’t support most of the user input events inherited from UIElement, such as KeyDown, KeyUp, and PointerPressed. A common workaround is to use InvokeScriptAsync with the JavaScript eval function to use the HTML event handlers, and to use window.external.notify from the HTML event handler to notify the application using WebView.ScriptNotify
I am fond of the type of side navigation menu that is common in mobile apps. An example is: http://www.jqueryscript.net/menu/jQuery-Animated-Side-Navigation-Menu-Plugin-Sidebar.html
Which works also for web pages. However, the vast majority of my page is in KendoUI, and I don't want to load another framework just for that.
Is there a combination of tricks with Kendo (draw control for example) that I could use to get the same effect?
Alternatively, I am all wet. I just want a quick way to have a "pop-up" of settings that are only occasionally used, and most of the time save the screen real-estate. So maybe just a button and a pop-up window is the correct approach?
Any advice?
I am developing a Cordova (PhoneGap) application using jQuery Mobile framework for Windows Phone 7. I'd like to get some pages refreshed/reloaded when the user hits the hardware back button. I am not using any data-rel="back" attribute.
How can I force the page to be reloaded when the user hits the hardware back-button?
Listen to the back button event and call the necessary code there. I'm not familiar with jQuery Mobile, but it seems like you could use changePage with the reloadPage option set to true.
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.
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.