我想在列表视图中显示图像,并且指针在图像上方,我将在图像底部显示文件大小/文件名和下载按钮。我也可以通过点击图像打开文件。
我注册了控件的 PointerEntered 和 PointerExited 事件,并尝试在触发事件时显示或隐藏文件大小/文件名/下载按钮。
当手指触摸图像时,PointerEntered 被触发。但是,在触摸屏(手机、平板电脑)上,当手指离开图像时,不会触发 PointerExited 事件。当我在平板电脑上使用鼠标操作时,一切正常。
这是我的代码片段:
<Grid>
<Interactivity:Interaction.Behaviors>
<Core:EventTriggerBehavior EventName="PointerEntered" >
<Core:InvokeCommandAction Command="{Binding ShowFileInfoCommand}"></Core:InvokeCommandAction>
</Core:EventTriggerBehavior>
<Core:EventTriggerBehavior EventName="PointerExited" >
<Core:InvokeCommandAction Command="{Binding HideFileInfoCommand}"></Core:InvokeCommandAction>
</Core:EventTriggerBehavior>
</Interactivity:Interaction.Behaviors>
<Image Source="{Binding ThumbnailUri}" Stretch="{Binding ImageStretch}" MaxHeight="200" MaxWidth="350" Height="{Binding FileHeight}" HorizontalAlignment="Right">
<Interactivity:Interaction.Behaviors>
<Core:EventTriggerBehavior EventName="Tapped" >
<Core:InvokeCommandAction Command="{Binding ConversationRoom.OpenFileFlipViewCommand,Source={StaticResource Locator}}" CommandParameter="{Binding}"/>
</Core:EventTriggerBehavior>
<Core:EventTriggerBehavior EventName="RightTapped">
<Core:InvokeCommandAction Command="{Binding RightTappedMessageCommand}"/>
</Core:EventTriggerBehavior>
</Interactivity:Interaction.Behaviors>
</Image>
<Grid Background="White" Opacity="0.75" Height="50" x:Name="InfoGrid" VerticalAlignment="Bottom" Visibility="{Binding NeedShowFileInfo, Converter={StaticResource BoolToVisible}}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Row="0" Margin="6,0,0,6" Text="{Binding FileName}"/>
<TextBlock Grid.Row="1" Margin="6,0,0,6" Text="{Binding FileSize}"/>
<FontIcon Grid.Row="1" Grid.Column="1" HorizontalAlignment="Right" Margin="0,0,6,6" Glyph="" FontFamily="../Assets/fontello.ttf#fontello">
<Interactivity:Interaction.Behaviors>
<Core:EventTriggerBehavior EventName="Tapped">
<Core:InvokeCommandAction Command="{Binding DownloadCommand}"/>
</Core:EventTriggerBehavior>
</Interactivity:Interaction.Behaviors>
</FontIcon>
</Grid>
</Grid>
如果我将网格移出列表视图,但在堆栈面板/网格中,一切正常。
任何人都可以帮助解决这个问题吗?谢谢!