我在我的网格上使用PointerEntered和PointerExited来改变指针在里面时的颜色,有时(大部分时间)PointerExited不会在我的w10m手机上触发,我用断点检查它。与Poiner相同(Canceled / CaptureLost)。即使我在网格外触摸,当指针在外面100%时,它也不会触发。
任何想法如何解决?
我的代码(如果需要):
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:
<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>
答案 0 :(得分:0)
我启动了我的应用程序而没有使用visual studio进行调试......它的工作正常100%。所以问题在于调试