如何在按下元素时创建MenuFlyout? [英] How to create MenuFlyout when element was pressed?

查看:76
本文介绍了如何在按下元素时创建MenuFlyout?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在按下元素时打开  MenuFlyout时遇到问题。

XAML:

 

< Grid PointerPressed =" GridPressed">

< FlyoutBase.AttachedFlyout>
< MenuFlyout>< / MenuFlyout>
< /FlyoutBase.AttachedFlyout>
< / Grid>


C#:

 private void GridPressed(object sender,PointerRoutedEventArgs e)
{
FlyoutBase.ShowAttachedFlyout((FrameworkElement)sender);
}


但是当我点击Grid时,MenuFlyout会打开。
想要 
这个菜单只会打开 
我按 它。

如何创建它?


解决方案

你想要使用RightTapped事件:


http://msdn.microsoft.com/en-us/library/windows/apps/xaml/windows.ui.xaml.uielement.righttapped.aspx


还可以看到UI指南:


参见
触摸交互设计

常见用户互动指南
了解更多信息


和此:


http://msdn.microsoft.com/en-us/library/窗口/应用/ XAML / windows.ui.xaml.uielement.holding.aspx


I have problems with opening MenuFlyout when element was pressed.
XAML:

<Grid PointerPressed="GridPressed">

<FlyoutBase.AttachedFlyout> <MenuFlyout></MenuFlyout> </FlyoutBase.AttachedFlyout> </Grid>

C#:

   private void GridPressed(object sender, PointerRoutedEventArgs e)
        {
            FlyoutBase.ShowAttachedFlyout((FrameworkElement)sender);           
        }

But when I tapped Grid, MenuFlyout opens. I want that this menu will open only when I pressed it.

How to create it?

解决方案

You want to use the RightTapped event:

http://msdn.microsoft.com/en-us/library/windows/apps/xaml/windows.ui.xaml.uielement.righttapped.aspx

also see the UI guidelines:

See Touch interaction design or Guidelines for common user interactions for more info

and this:

http://msdn.microsoft.com/en-us/library/windows/apps/xaml/windows.ui.xaml.uielement.holding.aspx


这篇关于如何在按下元素时创建MenuFlyout?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆