C# windows 10 UWP点退出不会在触摸屏上触发
我在我的网格上使用PointerEntered和PointerExited来更改指针位于内部时的颜色,有时(大多数情况下)PointerExited不会在我的w10m手机上触发,我使用断点来检查这一点。与Poiner相同(已取消/捕获丢失)。当指针100%在外时,即使我触到网格外,它也不会触发 有没有办法解决这个问题 我的代码(如果需要): XAML:C# windows 10 UWP点退出不会在触摸屏上触发,c#,windows-10,uwp,windows-10-mobile,C#,Windows 10,Uwp,Windows 10 Mobile,我在我的网格上使用PointerEntered和PointerExited来更改指针位于内部时的颜色,有时(大多数情况下)PointerExited不会在我的w10m手机上触发,我使用断点来检查这一点。与Poiner相同(已取消/捕获丢失)。当指针100%在外时,即使我触到网格外,它也不会触发 有没有办法解决这个问题 我的代码(如果需要): XAML: 我启动应用程序时没有使用visual studio进行调试,并且。。。它工作100%正确。所以问题出在调试中我没有用visual studio调
我启动应用程序时没有使用visual studio进行调试,并且。。。它工作100%正确。所以问题出在调试中我没有用visual studio调试就启动了我的应用程序,然后。。。它工作100%正确。因此,问题在于调试时,Touch作为一个概念没有指针。它有接触点进行交互,但没有指针悬停在某处的概念,因此进入/退出是一种毫无意义的概念。当用户实际使用鼠标或类似的指针设备时,您可能只需要更改颜色。概念上,触摸没有指针。它有接触点进行交互,但没有指针悬停在某处的概念,因此进入/退出是一种毫无意义的概念。您可能只应该在用户实际使用鼠标或类似的定点设备时更改颜色。
private void ButtonPointerEntered(object sender, PointerRoutedEventArgs e)
{
var c = (ButtonGrid.Background as SolidColorBrush).Color;
ButtonGrid.Background = new SolidColorBrush(Color.FromArgb(60, c.R, c.G, c.B));
}
private void ButtonPointerExited(object sender, PointerRoutedEventArgs e) //Does not trigger
{
var c = (ButtonGrid.Background as SolidColorBrush).Color;
ButtonGrid.Background = new SolidColorBrush(Color.FromArgb(0, c.R, c.G, c.B));
}
<Grid PointerEntered="ButtonPointerEntered" Tapped="ButtonTapped" x:Name="ButtonGrid" Background="{ThemeResource ApplicationForegroundThemeBrush}" PointerExited="ButtonPointerExited">
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition/>
</Grid.RowDefinitions>
<TextBlock x:Name="IconTB" FontFamily="Segoe MDL2 Assets" FontSize="18" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="0,3,0,0"/>
<TextBlock x:Name="TextTB" Grid.Row="1" FontSize="13" HorizontalAlignment="Center" TextWrapping="WrapWholeWords" TextAlignment="Center" Margin="0,0,0,2"/>
</Grid>