我想做的是,当我单击GridView
元素时,CommandBarFlyout
已关闭并且对该元素有一个单击。
我试图分配值OverlayInputPassThroughElement sender as FrameworkElement
。但是我还需要单击两次。
XAML:
<Page.Resources>
<CommandBarFlyout x:Name="CommandBarFlyout1"
Placement="RightEdgeAlignedTop">
<AppBarButton x:Name="EditButton1"
Label="Edit"
Icon="Edit"/>
<AppBarButton x:Name="DeleteButton1"
Label="Delete"
Icon="Delete"/>
</CommandBarFlyout>
</Page.Resources>
<Grid>
<GridView Padding="20">
<GridView.ItemTemplate>
<DataTemplate>
<Grid PointerEntered="Grid_PointerEntered"
PointerExited="Grid_PointerExited"
Tapped="Grid_Tapped">
<Border Height="200" Width="200">
<TextBlock Text="{Binding}"
FontSize="48" Foreground="Green"/>
</Border>
</Grid>
</DataTemplate>
</GridView.ItemTemplate>
<GridView.Items>
<x:String>One</x:String>
<x:String>Two</x:String>
</GridView.Items>
</GridView>
</Grid>
CS:
private void Grid_PointerEntered(object sender, PointerRoutedEventArgs e)
{
FlyoutShowOptions myOption = new FlyoutShowOptions();
myOption.ShowMode = FlyoutShowMode.Transient;
myOption.Placement = FlyoutPlacementMode.RightEdgeAlignedTop;
CommandBarFlyout1.OverlayInputPassThroughElement = sender as FrameworkElement;
CommandBarFlyout1.ShowAt(sender as FrameworkElement, myOption);
}
private void Grid_PointerExited(object sender, PointerRoutedEventArgs e)
{
CommandBarFlyout1.OverlayInputPassThroughElement = null;
CommandBarFlyout1.Hide();
}
private void Grid_Tapped(object sender, TappedRoutedEventArgs e)
{
Debug.WriteLine("Grid Click!");
}
或者也许你可以告诉我如何正确做
答案 0 :(得分:0)
我通过在<?php
session_start();
if (!isset($_SESSION['count']))
{
$_SESSION['count'] = 1;
}
else
{
++$_SESSION['count'];
}
echo $_SESSION['count'];
?>
中将Tapped
替换为ItemClick
来解决了这个问题
GridView