【问题标题】:how to detect the horizontal change when swiping inside a pivot control in windows phone 8如何在 Windows Phone 8 中的枢轴控件内滑动时检测水平变化
【发布时间】:2014-06-24 11:53:53
【问题描述】:

我想在 windows phone 8 中的枢轴控件内滑动时检测水平变化,以便我可以更改绑定到控件的集合,例如在向左或向右滑动时添加或删除项目。我想要的不是 selectionchanged 事件,因为我在那里遇到了一些问题。

【问题讨论】:

  • 也许你可以利用FrameReported事件——例如here

标签: c# xaml windows-phone-8 pivot


【解决方案1】:

试试这个:

public TakeTourPage()
{
    InitializeComponent();
    GestureListener gestureListener = GestureService.GetGestureListener(ContentPanel);
    gestureListener.DragCompleted += gestureListener_DragCompleted;
}

void gestureListener_DragCompleted(object sender, DragCompletedGestureEventArgs e)
{

    // User flicked towards left
    if (e.HorizontalVelocity < 0)
    {
    }

    // User flicked towards right
    if (e.HorizontalVelocity > 0)
    {
    }
 }

【讨论】:

  • 'Microsoft.Phone.Controls.GestureListener' 已过时:'GestureListener 从 Windows Phone 8 开始已过时,因为 UIElement 上的内置操作和手势事件现在与其功能相同。'
  • 如果你想使用,你可以使用它或者你应该去为windows phone 操作事件
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2023-04-04
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多