Skip to content

Commit

Permalink
fix tooltip closing and improve spacing
Browse files Browse the repository at this point in the history
  • Loading branch information
davidegiacometti committed Feb 8, 2024
1 parent 3d39107 commit 2ea0cec
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ internal static List<Result> GetResultList(in IEnumerable<RegistryEntry> list, i

result.Action = (_) => ContextMenuHelper.TryToOpenInRegistryEditor(entry);
result.ContextData = entry;
result.ToolTipData = new ToolTipData(Resources.RegistryKey, $"{Resources.KeyName}\t{result.Title}");
result.ToolTipData = new ToolTipData(Resources.RegistryKey, $"{Resources.KeyName} {result.Title}");

resultList.Add(result);
}
Expand Down Expand Up @@ -198,10 +198,10 @@ internal static string GetTruncatedText(string text, in int maxLength, TruncateS
/// <returns>A tool-tip text</returns>
private static string GetToolTipTextForRegistryValue(RegistryKey key, KeyValuePair<string, object> valueEntry)
{
return $"{Resources.KeyName}\t{key.Name}{Environment.NewLine}"
+ $"{Resources.Name}\t{valueEntry.Key}{Environment.NewLine}"
+ $"{Resources.Type}\t{ValueHelper.GetType(key, valueEntry.Key)}{Environment.NewLine}"
+ $"{Resources.Value}\t{ValueHelper.GetValue(key, valueEntry.Key)}";
return $"{Resources.KeyName} {key.Name}{Environment.NewLine}"
+ $"{Resources.Name} {valueEntry.Key}{Environment.NewLine}"
+ $"{Resources.Type} {ValueHelper.GetType(key, valueEntry.Key)}{Environment.NewLine}"
+ $"{Resources.Value} {ValueHelper.GetValue(key, valueEntry.Key)}";
}

/// <summary>
Expand Down
5 changes: 4 additions & 1 deletion src/modules/launcher/PowerLauncher/ResultList.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,19 +78,22 @@
<Grid.ToolTip>
<ToolTip
MaxWidth="480"
Closed="ToolTip_Closed"
Opened="ToolTip_Opened"
Visibility="{Binding Result.ToolTipVisibility}">
<StackPanel>
<TextBlock
FontWeight="SemiBold"
Style="{DynamicResource CollapsableTextblock}"
Text="{Binding Result.ToolTipData.Title}"
TextAlignment="Left"
TextWrapping="Wrap" />
<TextBlock
Margin="0,4,0,0"
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
Style="{DynamicResource CollapsableTextblock}"
Text="{Binding Result.ToolTipData.Text}"
TextAlignment="Left"
TextWrapping="Wrap" />
</StackPanel>
</ToolTip>
Expand Down Expand Up @@ -169,7 +172,7 @@
Command="{Binding Command}"
Style="{StaticResource SubtleButtonStyle}">
<ToolTipService.ToolTip>
<ToolTip Opened="ToolTip_Opened">
<ToolTip Closed="ToolTip_Closed" Opened="ToolTip_Opened">
<TextBlock
AutomationProperties.Name="{x:Static p:Resources.ContextMenuItemAdditionalInformation}"
Foreground="{DynamicResource TextFillColorPrimaryBrush}"
Expand Down
6 changes: 6 additions & 0 deletions src/modules/launcher/PowerLauncher/ResultList.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,5 +98,11 @@ private void SuggestionsListView_SelectionChanged(object sender, SelectionChange
HideCurrentToolTip();
}
}

private void ToolTip_Closed(object sender, RoutedEventArgs e)
{
HideCurrentToolTip();
_previouslyOpenedToolTip = null;
}
}
}

0 comments on commit 2ea0cec

Please sign in to comment.