我是Windows手机开发的初学者,我在纵向方向上以旋转视图方式扫描图像,我尝试了横向orintation,这是不成功的。请任何人帮我解决这个问题。
TouchPoint _first;
private List<TList> _pivotList;
public Pivot()
{
InitializeComponent();
Loaded += pivot_Loaded;
Touch.FrameReported += Touch_FrameReported;
}
private void Touch_FrameReported(object sender, TouchFrameEventArgs e)
{
TouchPoint mainTouch = e.GetPrimaryTouchPoint(null);
if (mainTouch.Action == TouchAction.Down)
_first = mainTouch;
else if (mainTouch.Action == TouchAction.Up)
{
var xDelta = mainTouch.Position.X - _first.Position.X;
var yDelta = Math.Abs(mainTouch.Position.Y - _first.Position.Y);
if (yDelta > Math.Abs(xDelta))
return;
if (Math.Abs(xDelta - 0) > 10)
{
var currentIndex = pivotList.SelectedIndex;
int noOfPivotItems = pivotList.Items.Count;
currentIndex = (xDelta < 0) ?
++currentIndex % noOfPivotItems :
(--currentIndex + noOfPivotItems) % noOfPivotItems;
pivotList.SelectedIndex = currentIndex;
}
}
}
答案 0 :(得分:0)
这是DisplayOrientations的代码。
public Pivot()
{
InitializeComponent();
Loaded += pivot_Loaded;
this.navigationHelper = new NavigationHelper(this);
Windows.Graphics.Display.DisplayInformation.AutoRotationPreferences = Windows.Graphics.Display.DisplayOrientations.Landscape;
Windows.Graphics.Display.DisplayInformation.AutoRotationPreferences = Windows.Graphics.Display.DisplayOrientations.PortraitFlipped;
}