2016-08-11 46 views
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> 
+0

触摸*有*没有指针,作为一个概念。它有交互的触点,但不是指针在某处悬停的概念,所以输入/退出是一种毫无意义的概念。您应该只在用户实际使用鼠标或类似的指针设备时进行颜色更改。 – Joey

回答

0

我开始了我的应用程序无需调试与Visual Studio和...它工作100%正确。所以问题在于调试