Tooltip for indexer and program plugin (#4589)

* Fix multiline title issue

* Added code to display tooltip for program and indexer plugin

* Added tests for Result class

* Theme based color for tooltip

* Added colors for tooltip

* Added string tags to tooltip

* Add initial show delay

* Seperated textbox for title and path
This commit is contained in:
Divyansh Srivastava
2020-07-07 13:02:39 -07:00
committed by GitHub
parent 1533c9315f
commit 8d72bc0ea4
28 changed files with 207 additions and 7 deletions

View File

@@ -113,6 +113,13 @@
</Setter.Value>
</Setter>
</Style>
<Style x:Key="CollapsableTextblock" TargetType="TextBlock">
<Style.Triggers>
<Trigger Property="Text" Value="">
<Setter Property="Visibility" Value="Collapsed"/>
</Trigger>
</Style.Triggers>
</Style>
</ResourceDictionary>
</UserControl.Resources>
@@ -137,7 +144,13 @@
<!--Style="{StaticResource ListViewNoAnimations}"-->
<ListView.ItemTemplate>
<DataTemplate >
<Grid Height="72" Width="642" Background="Transparent" >
<Grid
Height="72"
Width="642"
Background="Transparent"
ToolTipService.BetweenShowDelay="0"
ToolTipService.InitialShowDelay="1000"
>
<Behaviors:Interaction.Triggers>
<Behaviors:EventTrigger EventName="MouseEnter">
<Behaviors:InvokeCommandAction Command="{Binding ActivateContextButtonsHoverCommand}"/>
@@ -155,6 +168,26 @@
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ToolTip>
<ToolTip
Visibility="{Binding Result.ToolTipVisibility}"
BorderThickness="1"
BorderBrush="{DynamicResource ToolTipBorderBrushKey}"
Background="{DynamicResource ToolTipBackgroundBrushKey}">
<StackPanel>
<TextBlock
Style="{DynamicResource CollapsableTextblock}"
Text="{Binding Result.ToolTipData.Title}"
Foreground="{DynamicResource ToolTipForegroundBrushKey}"
TextWrapping="Wrap" />
<TextBlock
Style="{DynamicResource CollapsableTextblock}"
Text="{Binding Result.ToolTipData.Text}"
Foreground="{DynamicResource ToolTipForegroundBrushKey}"
TextWrapping="Wrap" />
</StackPanel>
</ToolTip>
</Grid.ToolTip>
<Image x:Name="AppIcon" Height="36" MaxWidth="56" Grid.RowSpan="2" Margin="-6,-2,0,0" HorizontalAlignment="Center" Source="{Binding Image}" />
<TextBlock x:Name="Title" Grid.Column="1" Text="{Binding Result.Title}" FontWeight="SemiBold" FontSize="20" Margin="0,0,0,-2" VerticalAlignment="Bottom"/>
<TextBlock x:Name="Path" Grid.Column="1" Text= "{Binding Result.SubTitle}" Grid.Row="1" Foreground="{DynamicResource SecondaryTextForeground}" Margin="0,2,0,0" VerticalAlignment="Top"/>

View File

@@ -43,4 +43,8 @@
<SolidColorBrush x:Key="ScrollBarLineButtonBackground" Color="Transparent"/>
<Color x:Key="ScrollBarLineButtonBackgroundPointerOver">#FF313131</Color>
<Color x:Key="ScrollBarLineButtonBackgroundPointerPressed">#FFa4a4a4</Color>
<SolidColorBrush x:Key="ToolTipBorderBrushKey" Color="#FFFFFFFF" />
<SolidColorBrush x:Key="ToolTipForegroundBrushKey" Color="#FFFFFFFF" />
<SolidColorBrush x:Key="ToolTipBackgroundBrushKey" Color="#FF171717" />
</ResourceDictionary>

View File

@@ -43,4 +43,8 @@
<SolidColorBrush x:Key="ScrollBarLineButtonBackground" Color="Black"/>
<Color x:Key="ScrollBarLineButtonBackgroundPointerOver">#FF000000</Color>
<Color x:Key="ScrollBarLineButtonBackgroundPointerPressed">#FF000000</Color>
<SolidColorBrush x:Key="ToolTipBorderBrushKey" Color="#FFFFFFFF" />
<SolidColorBrush x:Key="ToolTipForegroundBrushKey" Color="#FFFFFFFF" />
<SolidColorBrush x:Key="ToolTipBackgroundBrushKey" Color="#FF171717" />
</ResourceDictionary>

View File

@@ -43,4 +43,8 @@
<SolidColorBrush x:Key="ScrollBarLineButtonBackground" Color="Transparent"/>
<Color x:Key="ScrollBarLineButtonBackgroundPointerOver">#FF000000</Color>
<Color x:Key="ScrollBarLineButtonBackgroundPointerPressed">#FF000000</Color>
<SolidColorBrush x:Key="ToolTipBorderBrushKey" Color="#FFFFFFFF" />
<SolidColorBrush x:Key="ToolTipForegroundBrushKey" Color="#FFFFFFFF" />
<SolidColorBrush x:Key="ToolTipBackgroundBrushKey" Color="#FF171717" />
</ResourceDictionary>

View File

@@ -42,5 +42,8 @@
<SolidColorBrush x:Key="ScrollBarLineButtonBackground" Color="Transparent"/>
<Color x:Key="ScrollBarLineButtonBackgroundPointerOver">#FF000000</Color>
<Color x:Key="ScrollBarLineButtonBackgroundPointerPressed">#FF000000</Color>
<SolidColorBrush x:Key="ToolTipBorderBrushKey" Color="#FFFFFFFF" />
<SolidColorBrush x:Key="ToolTipForegroundBrushKey" Color="#FFFFFFFF" />
<SolidColorBrush x:Key="ToolTipBackgroundBrushKey" Color="#FF171717" />
</ResourceDictionary>

View File

@@ -42,4 +42,8 @@
<SolidColorBrush x:Key="ScrollBarLineButtonBackground" Color="Transparent"/>
<Color x:Key="ScrollBarLineButtonBackgroundPointerOver">#FF000000</Color>
<Color x:Key="ScrollBarLineButtonBackgroundPointerPressed">#FF000000</Color>
<SolidColorBrush x:Key="ToolTipBorderBrushKey" Color="#FF000000" />
<SolidColorBrush x:Key="ToolTipForegroundBrushKey" Color="#FF000000" />
<SolidColorBrush x:Key="ToolTipBackgroundBrushKey" Color="#FFF2F2F2" />
</ResourceDictionary>

View File

@@ -42,4 +42,8 @@
<SolidColorBrush x:Key="ScrollBarLineButtonBackground" Color="Transparent"/>
<Color x:Key="ScrollBarLineButtonBackgroundPointerOver">#FFd2d2d2</Color>
<Color x:Key="ScrollBarLineButtonBackgroundPointerPressed">#FF5d5d5d</Color>
<SolidColorBrush x:Key="ToolTipBorderBrushKey" Color="#FF000000" />
<SolidColorBrush x:Key="ToolTipForegroundBrushKey" Color="#FF000000" />
<SolidColorBrush x:Key="ToolTipBackgroundBrushKey" Color="#FFF2F2F2" />
</ResourceDictionary>