连接菜单Windows Phone 8.1

Sidemenu Windows Phone 8.1

我已经在 windowsphone 8 的 android 音乐播放器中实现了一个有效的弹出式侧边菜单。 为此,我使用了 Library Interactivity 来获得拖放功能。

现在好像不能再使用windowsphone 8.1的功能了。微软的自动转换工具我不能用。我们的项目是为多个平台制作的,并且具有可移植的 class 库。我们不得不淘汰 Silverlight 部分,这就是它不可转换的原因。

我在网上搜索了替代方法,比如使用手势识别器来做,但没有成功。

也许你们中的一些人有想法?

非常感谢任何回复。

这里是旧库的部分:

<i:Interaction.Behaviors>
                <el:MouseDragElementBehavior  ConstrainToParentBounds="True" 
                                              Dragging="MouseDragRight_Dragging" 
                                              DragFinished="MouseDragRight_DragFinished" 
                                              DragBegun="MouseDrag_DragBegan"/>
</i:Interaction.Behaviors>

查看 GestureRecognizerMSDN: GestureRecognizer

GestureRecognizer class 有这些事件。

横向滑动

Occurs when a user performs a slide or swipe gesture (through a single touch contact) within a content area that supports panning along a single axis only. The gesture must occur in a direction that is perpendicular to this panning axis.

拖拽

Occurs when a user performs a slide or swipe gesture with a mouse or pen/stylus (single contact). Holding Occurs when a user performs a press and hold gesture (with a single touch, mouse, or pen/stylus contact).

操作完成

Occurs when the input points are lifted and all subsequent motion (translation, expansion, or rotation) through inertia has ended.

ManipulationInertiaStarting

Occurs when all contact points are lifted during a manipulation and the velocity of the manipulation is significant enough to initiate inertia behavior (translation, expansion, or rotation continue after the input pointers are lifted).

操作开始

Occurs when one or more input points have been initiated and subsequent motion (translation, expansion, or rotation) has begun.

操作已更新

Occurs after one or more input points have been initiated and subsequent motion (translation, expansion, or rotation) is under way.

RightTapped

Occurs when the pointer input is interpreted as a right-tap gesture, regardless of input device. Tapped Occurs when the pointer input is interpreted as a tap gesture.

感谢 Chubosaurus 软件,我想通了:

1:使用您需要的设置创建 GestureRecognizer 的实例

GestureRecognizer _gestureRecognizer = new GestureRecognizer();
_gestureRecognizer.GestureSettings =  GestureSettings.CrossSlide ;

2: 连接你需要的事件

_gestureRecognizer.CrossSliding += _gestureRecognizer_CrossSliding;

3:根据您需要的手势,您必须将事件路由到识别器。在这种情况下是

private void MainViewGrid_PointerMoved(object sender, PointerRoutedEventArgs e)
{
   _gestureRecognizer.ProcessMoveEvents(e.GetIntermediatePoints(MainViewGrid));
}

private void MainViewGrid_PointerPressed(object sender, PointerRoutedEventArgs e)
{
   _gestureRecognizer.ProcessDownEvent(e.GetCurrentPoint(MainViewGrid));
}

private void MainViewGrid_PointerReleased(object sender, PointerRoutedEventArgs e)
{
   _gestureRecognizer.ProcessUpEvent(e.GetCurrentPoint(MainViewGrid));
}