如何在按下元素时创建MenuFlyout? [英] How to create MenuFlyout when element was pressed?
问题描述
我在按下元素时打开 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屋!