[英]windows 10 UWP PointerExited does not trigger on touch screen
I'm using PointerEntered and PointerExited on my grid to change it's color when pointer is inside, and sometimes (most of time) PointerExited does not trigger on my w10m phone, I used break point to check that. 我在我的网格上使用PointerEntered和PointerExited来改变指针在里面的颜色,有时(大部分时间)PointerExited不会在我的w10m手机上触发,我用断点检查它。 Same with Poiner(Canceled/CaptureLost).
与Poiner相同(Canceled / CaptureLost)。 It doesn't trigger even if I touch outside the grid, when pointer is 100% outside.
即使我在网格外触摸,当指针在外面100%时,它也不会触发。
Any ideas how to fix that? 任何想法如何解决?
My code (if needed): 我的代码(如果需要):
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));
}
XAML: XAML:
<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>
I started my app without debugging with visual studio and... It work 100% correct. 我启动了我的应用程序,没有使用visual studio进行调试......它正常工作100%。 So the problem was in debugging
所以问题出在调试上
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.