I added a WebBrowser as the content of one of the panorama items. The WebBrowser gets rendered with no issues. If I swipe the panorama by touching the area outside the WebBrowser the swipe happens. But when I try to swipe the panorama by touching the WebBrowser, the swipe does not happen, instead the WebBrowser scrolls vertically. Any idea how this can be fixed ?
Asked
Active
Viewed 784 times
2
-
Have no idea why this is down voted ???!!! – saikamesh May 07 '13 at 11:02
-
Why this is down voted?? i am also having the same issue..Please help.. – Sachin123 May 15 '13 at 06:21
-
??? How should the system know if you want to swipe the panorama or the content of the webBrowser? Thats like having 2 papers one over the other and you wanting that when you write on the first paper the 2nd one is marked and not the first one. – David Jul 08 '13 at 11:08
2 Answers
0
I didn't downvote, but probably, because its a bad idea. By design, those items should not be combined. However, if you really want to keep browser inside pivot, you can take a glance here

Vitalii Vasylenko
- 4,776
- 5
- 40
- 64
0
While you'll undoubtedly come to find that this is not recommended by the UI guidelines, this was a necessary requirement in my case and I was able to work around this by subscribing directly to the Touch events and manually detecting a swipe:
// controls "swipe" behavior
private Point touchDownPosition; // last position of touch down
private int touchDownTime; // last time of touch down
private int touchUpTime; // last time of touch up
private int swipeMaxTime = 1000; // time (in milliseconds) that a swipe must occur in
private int swipeMinDistance = 25;// distance (in pixels) that a swipe must cover
private int swipeMinBounceTime = 500; // time (in milliseconds) between multiple touch events (minimizes "bounce")
// handler for touch events
void Touch_FrameReported(object sender, TouchFrameEventArgs e)
{
var item = MyPivot.SelectedItem as PivotItem;
// ignore touch if we are not on the browser pivot item
if (item != BrowserPivotItem)
return;
var point = e.GetPrimaryTouchPoint(item);
switch (point.Action)
{
case TouchAction.Down:
touchDownTime = e.Timestamp;
touchDownPosition = point.Position;
touchUpTime = 0;
break;
case TouchAction.Up:
// often multiple touch up events are fired, ignore re-fired events
if (touchUpTime != 0 && touchUpTime - e.Timestamp < swipeMinBounceTime)
return;
touchUpTime = e.Timestamp;
var xDelta = point.Position.X - touchDownPosition.X;
var yDelta = point.Position.Y - touchDownPosition.Y;
// ensure touch event meets the requirements for a "swipe"
if (touchUpTime - touchDownTime < swipeMaxTime && Math.Abs(xDelta) > swipeMinDistance && Math.Abs(xDelta) > Math.Abs(yDelta))
{
// advance to next pivot item depending on swipe direction
var iNext = MyPivot.SelectedIndex + (delta > 0 ? -1 : 1);
iNext = iNext < 0 || iNext == MyPivot.Items.Count ? 0 : iNext;
MyPivot.SelectedIndex = iNext;
}
break;
}
}
Then subscribe to the Touch.FrameReported where desired, or for better optimization, subscribe to the event handler only while the pivot item containing the browser is selected:
private void MyPivot_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
{
if ((sender as Pivot).SelectedItem == BrowserPivotItem)
Touch.FrameReported += Touch_FrameReported;
else
Touch.FrameReported -= Touch_FrameReported;
}

apenn
- 65
- 5