2020-06-02 03:35:37 +08:00
|
|
|
<UserControl
|
|
|
|
x:Class="PowerLauncher.ResultList"
|
|
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
|
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|
|
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
|
|
xmlns:Behaviors="http://schemas.microsoft.com/xaml/behaviors"
|
2020-09-03 06:24:59 +08:00
|
|
|
xmlns:p="clr-namespace:PowerLauncher.Properties"
|
2021-06-09 02:23:27 +08:00
|
|
|
xmlns:helper="clr-namespace:PowerLauncher.Helper"
|
|
|
|
xmlns:converters="clr-namespace:PowerLauncher.Converters"
|
|
|
|
xmlns:viewmodel="clr-namespace:PowerLauncher.ViewModel"
|
|
|
|
mc:Ignorable="d"
|
2020-06-02 03:35:37 +08:00
|
|
|
d:DesignHeight="300"
|
|
|
|
d:DesignWidth="720">
|
|
|
|
|
|
|
|
<UserControl.Resources>
|
|
|
|
|
2021-06-09 02:23:27 +08:00
|
|
|
<ResourceDictionary>
|
|
|
|
<converters:HighlightTextConverter x:Key="highlightTextConverter" />
|
|
|
|
|
2020-06-02 03:35:37 +08:00
|
|
|
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
|
|
|
|
<Style x:Key="FocusVisual">
|
|
|
|
<Setter Property="Control.Template">
|
|
|
|
<Setter.Value>
|
|
|
|
<ControlTemplate>
|
2020-10-09 11:14:00 +08:00
|
|
|
<Rectangle Margin="2"
|
|
|
|
StrokeDashArray="1 2"
|
|
|
|
SnapsToDevicePixels="true"
|
|
|
|
StrokeThickness="1"
|
|
|
|
Stroke="{DynamicResource ControlTextBrushKey}"/>
|
2020-06-02 03:35:37 +08:00
|
|
|
</ControlTemplate>
|
|
|
|
</Setter.Value>
|
|
|
|
</Setter>
|
|
|
|
</Style>
|
|
|
|
|
|
|
|
<Style x:Key="IconButtonStyle" TargetType="{x:Type Button}">
|
|
|
|
<Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}"/>
|
2020-06-06 00:58:30 +08:00
|
|
|
<Setter Property="Foreground" Value="{DynamicResource ControlTextBrushKey}"/>
|
2020-06-02 03:35:37 +08:00
|
|
|
<Setter Property="BorderThickness" Value="1"/>
|
2020-07-18 03:29:36 +08:00
|
|
|
<Setter Property="Focusable" Value="False"/>
|
2020-06-02 03:35:37 +08:00
|
|
|
<Setter Property="HorizontalContentAlignment" Value="Center"/>
|
|
|
|
<Setter Property="VerticalContentAlignment" Value="Center"/>
|
|
|
|
<Setter Property="Padding" Value="1"/>
|
|
|
|
<Setter Property="Template">
|
|
|
|
<Setter.Value>
|
|
|
|
<ControlTemplate TargetType="{x:Type Button}">
|
2020-10-09 11:14:00 +08:00
|
|
|
<Border x:Name="border"
|
|
|
|
CornerRadius="2"
|
|
|
|
Background="Transparent"
|
|
|
|
BorderThickness="{TemplateBinding BorderThickness}"
|
|
|
|
BorderBrush="Transparent"
|
|
|
|
SnapsToDevicePixels="true">
|
|
|
|
<ContentPresenter x:Name="contentPresenter"
|
|
|
|
Focusable="False"
|
|
|
|
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
|
|
|
Margin="{TemplateBinding Padding}"
|
|
|
|
RecognizesAccessKey="True"
|
|
|
|
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
|
|
|
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
|
2020-06-02 03:35:37 +08:00
|
|
|
</Border>
|
|
|
|
<ControlTemplate.Triggers>
|
|
|
|
<Trigger Property="IsDefaulted" Value="true">
|
|
|
|
<Setter Property="Background" TargetName="border" Value="Transparent"/>
|
|
|
|
<Setter Property="BorderBrush" TargetName="border" Value="Transparent"/>
|
|
|
|
</Trigger>
|
|
|
|
<Trigger Property="IsMouseOver" Value="true">
|
|
|
|
<Setter Property="Background" TargetName="border" Value="{DynamicResource ButtonBackgroundPointerOver}"/>
|
|
|
|
<Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource ButtonBorderPointerOver}"/>
|
|
|
|
</Trigger>
|
|
|
|
<Trigger Property="IsPressed" Value="true">
|
|
|
|
<Setter Property="Background" TargetName="border" Value="{DynamicResource ButtonBackgroundPressed}"/>
|
|
|
|
<Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource ButtonBorderPressed}"/>
|
|
|
|
</Trigger>
|
|
|
|
<Trigger Property="IsEnabled" Value="false">
|
|
|
|
<!--<Setter Property="Background" TargetName="border" Value="{StaticResource Button.Disabled.Background}"/>
|
|
|
|
<Setter Property="BorderBrush" TargetName="border" Value="{StaticResource Button.Disabled.Border}"/>
|
|
|
|
<Setter Property="TextElement.Foreground" TargetName="contentPresenter" Value="{StaticResource Button.Disabled.Foreground}"/>-->
|
|
|
|
</Trigger>
|
|
|
|
</ControlTemplate.Triggers>
|
|
|
|
</ControlTemplate>
|
|
|
|
</Setter.Value>
|
|
|
|
</Setter>
|
|
|
|
</Style>
|
|
|
|
|
|
|
|
<Style x:Key="ResultsListViewItemContainerStyle" TargetType="ListViewItem">
|
|
|
|
<Setter Property="Background" Value="Transparent" />
|
2020-06-06 00:58:30 +08:00
|
|
|
<Setter Property="Foreground" Value="{DynamicResource ControlTextBrushKey}" />
|
2020-06-02 03:35:37 +08:00
|
|
|
<Setter Property="Template">
|
|
|
|
<Setter.Value>
|
|
|
|
<ControlTemplate TargetType="{x:Type ListViewItem}">
|
|
|
|
<Grid Background="Transparent">
|
2020-10-09 11:14:00 +08:00
|
|
|
<Border x:Name="HighlightBorder"
|
|
|
|
BorderThickness="0"
|
2021-01-07 02:00:36 +08:00
|
|
|
CornerRadius="4"
|
2020-10-09 11:14:00 +08:00
|
|
|
Background="{DynamicResource SystemChromeLow}"
|
|
|
|
BorderBrush="Transparent"
|
|
|
|
SnapsToDevicePixels="true"/>
|
|
|
|
<ContentPresenter x:Name="contentPresenter"
|
|
|
|
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
|
|
|
Margin="{TemplateBinding Padding}" RecognizesAccessKey="True"
|
|
|
|
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
|
|
|
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
|
2020-06-02 03:35:37 +08:00
|
|
|
</Grid>
|
|
|
|
<ControlTemplate.Triggers>
|
|
|
|
<Trigger Property="IsMouseOver" Value="True">
|
|
|
|
<Setter Property="Background" TargetName="HighlightBorder" Value="{DynamicResource ListViewItemBackgroundPointerOver}"/>
|
|
|
|
</Trigger>
|
|
|
|
<Trigger Property="IsSelected" Value="True">
|
2021-01-07 02:00:36 +08:00
|
|
|
<Setter Property="Background" TargetName="HighlightBorder" Value="{DynamicResource SystemControlHighlightListAccentLowBrush}" />
|
2020-06-02 03:35:37 +08:00
|
|
|
</Trigger>
|
|
|
|
</ControlTemplate.Triggers>
|
|
|
|
</ControlTemplate>
|
|
|
|
</Setter.Value>
|
|
|
|
</Setter>
|
2020-07-18 03:29:36 +08:00
|
|
|
<Setter Property="Focusable" Value="False" />
|
2020-06-02 03:35:37 +08:00
|
|
|
</Style>
|
|
|
|
|
|
|
|
<Style x:Key="CommandButtonListViewItemContainerStyle" TargetType="ListViewItem">
|
|
|
|
<Setter Property="Background" Value="Transparent" />
|
|
|
|
<Setter Property="Padding" Value="0" />
|
2020-08-21 12:45:55 +08:00
|
|
|
<Setter Property="Margin" Value="1" />
|
2020-06-02 03:35:37 +08:00
|
|
|
<Setter Property="Template">
|
|
|
|
<Setter.Value>
|
|
|
|
<ControlTemplate TargetType="{x:Type ListViewItem}">
|
2020-10-09 11:14:00 +08:00
|
|
|
<Border x:Name="border"
|
|
|
|
CornerRadius="4"
|
|
|
|
Background="Transparent"
|
|
|
|
BorderBrush="Transparent"
|
|
|
|
SnapsToDevicePixels="true">
|
|
|
|
<ContentPresenter x:Name="contentPresenter"
|
|
|
|
Focusable="False"
|
|
|
|
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
|
|
|
Margin="{TemplateBinding Padding}"
|
|
|
|
RecognizesAccessKey="True"
|
|
|
|
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
|
|
|
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
|
2020-06-02 03:35:37 +08:00
|
|
|
</Border>
|
|
|
|
<ControlTemplate.Triggers>
|
|
|
|
<Trigger Property="IsMouseOver" Value="true">
|
|
|
|
<Setter Property="Background" TargetName="border" Value="Transparent"/>
|
|
|
|
<Setter Property="BorderBrush" TargetName="border" Value="Transparent"/>
|
|
|
|
</Trigger>
|
|
|
|
<Trigger Property="IsSelected" Value="True">
|
|
|
|
<Setter Property="Background" TargetName="border" Value="{DynamicResource ButtonBackgroundPressed}"/>
|
|
|
|
<Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource ButtonBorderPressed}"/>
|
|
|
|
</Trigger>
|
|
|
|
</ControlTemplate.Triggers>
|
|
|
|
</ControlTemplate>
|
|
|
|
</Setter.Value>
|
|
|
|
</Setter>
|
|
|
|
</Style>
|
2021-01-07 02:00:36 +08:00
|
|
|
<Style x:Key="CollapsableTextblock"
|
|
|
|
TargetType="TextBlock">
|
2020-07-08 04:02:39 +08:00
|
|
|
<Style.Triggers>
|
2021-01-07 02:00:36 +08:00
|
|
|
<Trigger Property="Text"
|
|
|
|
Value="">
|
|
|
|
<Setter Property="Visibility"
|
|
|
|
Value="Collapsed" />
|
2020-07-08 04:02:39 +08:00
|
|
|
</Trigger>
|
|
|
|
</Style.Triggers>
|
|
|
|
</Style>
|
2020-06-02 03:35:37 +08:00
|
|
|
</ResourceDictionary>
|
|
|
|
</UserControl.Resources>
|
|
|
|
|
|
|
|
<Grid VerticalAlignment="Top">
|
|
|
|
<ListView
|
|
|
|
x:Name="SuggestionsList"
|
|
|
|
x:FieldModifier="public"
|
|
|
|
Background="Transparent"
|
|
|
|
BorderThickness="0"
|
|
|
|
MaxHeight="{Binding Results.MaxHeight}"
|
|
|
|
Margin="0"
|
|
|
|
ItemsSource="{Binding Results.Results, Mode=OneWay}"
|
|
|
|
Padding="0, 0"
|
|
|
|
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
|
2020-06-18 00:48:30 +08:00
|
|
|
ScrollViewer.VerticalScrollBarVisibility="Auto"
|
2020-06-02 03:35:37 +08:00
|
|
|
SelectionMode="Single"
|
|
|
|
SelectedIndex="{Binding Results.SelectedIndex, Mode=TwoWay}"
|
2020-08-06 04:43:47 +08:00
|
|
|
ItemContainerStyle="{StaticResource ResultsListViewItemContainerStyle}"
|
2020-09-03 06:24:59 +08:00
|
|
|
AutomationProperties.Name="{x:Static p:Resources.Results}">
|
2020-06-02 03:35:37 +08:00
|
|
|
|
|
|
|
<!--AllowFocusOnInteraction="False"
|
|
|
|
IsItemClickEnabled="True"-->
|
|
|
|
<!--Style="{StaticResource ListViewNoAnimations}"-->
|
|
|
|
<ListView.ItemTemplate>
|
2020-08-06 04:43:47 +08:00
|
|
|
<DataTemplate>
|
2020-07-08 04:02:39 +08:00
|
|
|
<Grid
|
|
|
|
Height="72"
|
|
|
|
Width="642"
|
|
|
|
Background="Transparent"
|
|
|
|
ToolTipService.BetweenShowDelay="0"
|
2020-10-09 11:14:00 +08:00
|
|
|
ToolTipService.InitialShowDelay="1000">
|
2020-06-02 03:35:37 +08:00
|
|
|
<Behaviors:Interaction.Triggers>
|
|
|
|
<Behaviors:EventTrigger EventName="MouseEnter">
|
|
|
|
<Behaviors:InvokeCommandAction Command="{Binding ActivateContextButtonsHoverCommand}"/>
|
|
|
|
</Behaviors:EventTrigger>
|
|
|
|
<Behaviors:EventTrigger EventName="MouseLeave">
|
|
|
|
<Behaviors:InvokeCommandAction Command="{Binding DeactivateContextButtonsHoverCommand}"/>
|
|
|
|
</Behaviors:EventTrigger>
|
|
|
|
</Behaviors:Interaction.Triggers>
|
|
|
|
<Grid.ColumnDefinitions>
|
|
|
|
<ColumnDefinition Width="64" />
|
|
|
|
<ColumnDefinition Width="*" />
|
|
|
|
<ColumnDefinition Width="Auto" />
|
|
|
|
</Grid.ColumnDefinitions>
|
|
|
|
<Grid.RowDefinitions >
|
|
|
|
<RowDefinition Height="*"/>
|
|
|
|
<RowDefinition Height="*"/>
|
|
|
|
</Grid.RowDefinitions>
|
2020-07-08 04:02:39 +08:00
|
|
|
<Grid.ToolTip>
|
2020-07-11 03:06:57 +08:00
|
|
|
<ToolTip Visibility="{Binding Result.ToolTipVisibility}">
|
2021-01-07 02:00:36 +08:00
|
|
|
<StackPanel>
|
2020-07-08 04:02:39 +08:00
|
|
|
<TextBlock
|
|
|
|
Style="{DynamicResource CollapsableTextblock}"
|
2021-01-07 02:00:36 +08:00
|
|
|
FontWeight="Bold"
|
2020-07-08 04:02:39 +08:00
|
|
|
Text="{Binding Result.ToolTipData.Title}"
|
2021-04-05 22:26:24 +08:00
|
|
|
TextWrapping="Wrap" />
|
2020-07-08 04:02:39 +08:00
|
|
|
<TextBlock
|
|
|
|
Style="{DynamicResource CollapsableTextblock}"
|
2020-07-18 03:29:36 +08:00
|
|
|
Text="{Binding Result.ToolTipData.Text}"
|
2021-04-05 22:26:24 +08:00
|
|
|
TextWrapping="Wrap" />
|
2020-07-08 04:02:39 +08:00
|
|
|
</StackPanel>
|
|
|
|
</ToolTip>
|
|
|
|
</Grid.ToolTip>
|
2020-10-09 11:14:00 +08:00
|
|
|
<Image
|
|
|
|
AutomationProperties.Name="{x:Static p:Resources.AppIcon}"
|
|
|
|
x:Name="AppIcon"
|
|
|
|
Height="36"
|
|
|
|
MaxWidth="56"
|
|
|
|
Grid.RowSpan="2"
|
|
|
|
Margin="-6,-2,0,0"
|
|
|
|
HorizontalAlignment="Center"
|
|
|
|
Source="{Binding Image}" />
|
2021-06-09 02:23:27 +08:00
|
|
|
<TextBlock AutomationProperties.Name="{x:Static p:Resources.Title}"
|
|
|
|
x:Name="Title"
|
|
|
|
Grid.Column="1"
|
|
|
|
FontSize="20"
|
|
|
|
Margin="0,0,0,-2"
|
|
|
|
VerticalAlignment="Bottom">
|
|
|
|
<viewmodel:ResultsViewModel.FormattedText>
|
|
|
|
<MultiBinding Converter="{StaticResource highlightTextConverter}">
|
|
|
|
<Binding Path="Result.Title" />
|
|
|
|
<Binding Path="Result.TitleHighlightData" />
|
|
|
|
<Binding RelativeSource="{RelativeSource Mode=FindAncestor,AncestorType={x:Type ListViewItem}}"
|
|
|
|
Path="IsSelected" />
|
|
|
|
</MultiBinding>
|
|
|
|
</viewmodel:ResultsViewModel.FormattedText>
|
|
|
|
</TextBlock>
|
2020-10-09 11:14:00 +08:00
|
|
|
<TextBlock
|
|
|
|
AutomationProperties.Name="{x:Static p:Resources.Subtitle}"
|
|
|
|
x:Name="Path"
|
|
|
|
Grid.Column="1"
|
|
|
|
Text= "{Binding Result.SubTitle}"
|
|
|
|
Grid.Row="1"
|
|
|
|
Foreground="{DynamicResource SecondaryTextForeground}"
|
|
|
|
Margin="0,2,0,0"
|
2021-04-05 22:26:24 +08:00
|
|
|
VerticalAlignment="Top"/>
|
2020-08-06 04:43:47 +08:00
|
|
|
<ListView
|
2020-09-03 06:24:59 +08:00
|
|
|
AutomationProperties.Name="{x:Static p:Resources.ContextMenuItemsCollection}"
|
2020-06-02 03:35:37 +08:00
|
|
|
HorizontalAlignment="Right"
|
|
|
|
VerticalAlignment="Center"
|
|
|
|
Background="Transparent"
|
|
|
|
BorderThickness="0"
|
|
|
|
Grid.RowSpan="2"
|
|
|
|
Grid.Column="2"
|
|
|
|
ScrollViewer.VerticalScrollBarVisibility="Disabled"
|
|
|
|
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
|
|
|
|
ItemsSource="{Binding ContextMenuItems}"
|
|
|
|
SelectionMode="Single"
|
2020-06-27 07:12:26 +08:00
|
|
|
Margin="0,0,-8,0"
|
2020-06-02 03:35:37 +08:00
|
|
|
SelectedIndex="{Binding ContextMenuSelectedIndex}"
|
|
|
|
Visibility="{Binding AreContextButtonsActive, Converter={StaticResource BooleanToVisibilityConverter}}"
|
|
|
|
ItemContainerStyle="{StaticResource CommandButtonListViewItemContainerStyle}">
|
|
|
|
<ItemsControl.ItemsPanel>
|
|
|
|
<ItemsPanelTemplate>
|
|
|
|
<StackPanel Orientation="Horizontal"
|
|
|
|
VerticalAlignment="Center"
|
|
|
|
HorizontalAlignment="Center"/>
|
|
|
|
</ItemsPanelTemplate>
|
|
|
|
</ItemsControl.ItemsPanel>
|
|
|
|
<ListView.ItemTemplate>
|
|
|
|
<DataTemplate>
|
2020-10-09 11:14:00 +08:00
|
|
|
<Button
|
|
|
|
AutomationProperties.Name="{x:Static p:Resources.ContextMenuItem}"
|
|
|
|
Style="{StaticResource IconButtonStyle}"
|
|
|
|
Command="{Binding Command}"
|
|
|
|
VerticalAlignment="Center"
|
|
|
|
Height="42"
|
|
|
|
Width="42"
|
|
|
|
BorderThickness="1" >
|
2020-06-02 03:35:37 +08:00
|
|
|
<ToolTipService.ToolTip>
|
2020-07-11 03:06:57 +08:00
|
|
|
<ToolTip >
|
2020-10-09 11:14:00 +08:00
|
|
|
<TextBlock
|
|
|
|
AutomationProperties.Name="{x:Static p:Resources.ContextMenuItemAdditionalInformation}"
|
2021-04-05 22:26:24 +08:00
|
|
|
Text="{Binding Title}"/>
|
2020-07-11 03:06:57 +08:00
|
|
|
</ToolTip>
|
2020-06-02 03:35:37 +08:00
|
|
|
</ToolTipService.ToolTip>
|
|
|
|
<Button.Content>
|
2020-10-09 11:14:00 +08:00
|
|
|
<TextBlock
|
|
|
|
AutomationProperties.Name="{x:Static p:Resources.ContextMenuIcon}"
|
|
|
|
FontFamily="{Binding FontFamily}"
|
|
|
|
FontSize="16"
|
2021-04-05 22:26:24 +08:00
|
|
|
Text="{Binding Glyph}"/>
|
2020-06-02 03:35:37 +08:00
|
|
|
</Button.Content>
|
|
|
|
</Button>
|
|
|
|
</DataTemplate>
|
|
|
|
</ListView.ItemTemplate>
|
|
|
|
</ListView>
|
|
|
|
</Grid>
|
|
|
|
</DataTemplate>
|
|
|
|
</ListView.ItemTemplate>
|
|
|
|
</ListView>
|
|
|
|
</Grid>
|
|
|
|
</UserControl>
|