【发布时间】:2014-01-03 14:31:55
【问题描述】:
我正在尝试找到一种解决方案,以允许集线器在到达左边界或右边界时用鼠标平移。我已经实现了我从各种来源收集到的以下代码。
` private void theHubPointerMoved(object sender, PointerRoutedEventArgs e)
{ Windows.UI.Xaml.Input.Pointer ptr = e.Pointer;
if (ptr.PointerDeviceType == Windows.Devices.Input.PointerDeviceType.Mouse)
{
Windows.UI.Input.PointerPoint ptrPt = e.GetCurrentPoint(null);
if (ptrPt.Position.X < this.ActualWidth - 20)
if (ptrPt.Position.X > 20)
{
//Do the SCROLLING HERE
var xcord = Math.Round(ptrPt.Position.X, 2);
var ycord = Math.Round(ptrPt.Position.Y, 2);
}
}
e.Handled = true;
}`
因此,当鼠标位于屏幕边缘时,相对容易看到。我认为简单地使用 MyHub.ScrollViewer.ScrollToHorizontalOffset(xcord); 会很容易,但 Hub Scrollviewer 不会公开此 ScrollToHorizontalOffset 函数。
有人可以帮忙吗?
谢谢。
【问题讨论】:
标签: windows-8 windows-store-apps scrollview winrt-xaml horizontaloffset