1
我在我的網格上使用PointerEntered和PointerExited在指針位於內部時更改它的顏色,有時(大部分時間)PointerExited不會在我的w10m手機上觸發,我使用斷點檢查。與Poiner相同(已取消/ CaptureLost)。即使我觸摸外部網格,當指針在外部100%時,它也不會觸發。windows 10 UWP PointerExited不會在觸摸屏上觸發
任何想法如何解決這個問題?
我的代碼(如果需要):
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>
觸摸*有*沒有指針,作爲一個概念。它有交互的觸點,但不是指針在某處懸停的概念,所以輸入/退出是一種毫無意義的概念。您應該只在用戶實際使用鼠標或類似的指針設備時進行顏色更改。 – Joey