リストビューに画像を表示したいのですが、ポインタが画像の上にあり、画像の下部にファイルサイズ/ファイル名とダウンロード ボタンが表示されます。また、画像をタップしてファイルを開くこともできます。
コントロールの 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>
そして、グリッドをリストビューの外に移動しても、スタックパネル/グリッドではすべてうまくいきます。
誰でもこの問題を解決できますか? ありがとうございました!