Merge pull request #5767 from Open-KFC/main

fix #5744: 模组下载界面显示Tooltip时滚动鼠标致使该Tooltip被永远隐藏
This commit is contained in:
龙腾猫跃
2026-07-17 12:34:13 +08:00
committed by GitHub
3 changed files with 36 additions and 6 deletions
+31
View File
@@ -132,6 +132,37 @@
<Setter Property="FontFamily" Value="Resources/#PCL English, Microsoft YaHei UI" />
</Style>
<!-- ToolTip -->
<Style TargetType="ToolTip">
<EventSetter Event="Opened" Handler="OnTooltipOpened" />
<EventSetter Event="Closed" Handler="OnTooltipClosed" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<Border BorderBrush="{DynamicResource ColorBrush1}" BorderThickness="1.5" CornerRadius="4" MaxWidth="500" Background="#E5FFFFFF" Margin="0,0,4,4" SnapsToDevicePixels="True">
<Border.Effect>
<DropShadowEffect Opacity="0.3" BlurRadius="4" ShadowDepth="2" Color="{DynamicResource ColorObject1}" />
</Border.Effect>
<TextBlock Text="{TemplateBinding ContentControl.Content}" TextWrapping="Wrap" Foreground="{DynamicResource ColorBrush1}" Margin="7,5" FontSize="12"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="ExtendTextToolTip" TargetType="ToolTip">
<EventSetter Event="Opened" Handler="OnTooltipOpened" />
<EventSetter Event="Closed" Handler="OnTooltipClosed" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<Border BorderBrush="{DynamicResource ColorBrush1}" BorderThickness="1" CornerRadius="3" Background="White" Margin="0,0,4,4" SnapsToDevicePixels="True">
<TextBlock Text="{TemplateBinding ContentControl.Content}" TextWrapping="Wrap" Foreground="{DynamicResource ColorBrush1}" Margin="7,5" FontSize="12"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- ScrollViewer -->
<Style x:Key="MyThumb" TargetType="Thumb">
<Setter Property="Stylus.IsPressAndHoldEnabled" Value="false"/>
+3 -3
View File
@@ -290,11 +290,11 @@ RetryCacheCheck:
End Select
End Sub
Public Shared ShowingTooltips As New List(Of Border)
Private Sub TooltipLoaded(sender As Border, e As EventArgs)
Public Shared ShowingTooltips As New List(Of ToolTip)
Private Sub OnTooltipOpened(sender As ToolTip, e As RoutedEventArgs)
ShowingTooltips.Add(sender)
End Sub
Private Sub TooltipUnloaded(sender As Border, e As RoutedEventArgs)
Private Sub OnTooltipClosed(sender As ToolTip, e As RoutedEventArgs)
ShowingTooltips.Remove(sender)
End Sub
@@ -19,9 +19,8 @@ Public Class MyScrollViewer
e.Handled = True
PerformVerticalOffsetDelta(-e.Delta)
'关闭 Tooltip (#2552)
For Each TooltipBorder In Application.ShowingTooltips
AniStart(AaOpacity(TooltipBorder, -1, 100), $"Hide Tooltip {GetUuid()}")
Next
'通过 IsOpen 关闭 Tooltip 而不是降低 Border 不透明度 (#5744)
Application.ShowingTooltips.ForEach(Sub(tooltip) tooltip.IsOpen = False)
End Sub
Public Sub PerformVerticalOffsetDelta(Delta As Double)
AniStart(