Files
PowerToys/src/modules/launcher/PowerLauncher/ResultList.xaml
Niels Laute c095cdde4e [PTRun]Fluent UX and switch to WpfUI (#28538)
* New design

* Updating icons

* Adding keywords

* Only show plugins when search query is empty

* Update App.xaml

* Update App.xaml

* Filter plugins

* Fix image name

* refresh plugins overview

* fix context menu icons in win10

* Remove unused animations

* Resolving crashing

* Fix focus visual and a11y

* Remove unused styles

* Revert "Remove unused styles"

This reverts commit 65f29ae6ed.

* Fix value generator light vs dark icon

* Fix tab characters

* Fix CI

* Update SettingsReader.cs

* Adding common OS check helper

* Update MainWindow.xaml.cs

* Fix background

* More tweaks

* XAML styler and updating legacy brushes

* Updates + xaml styling

* Fix CI

* Fix CI2

* fix font family and overview refresh

* Delete shutdown.light-1.png

* Updating icons

* Set DPI

---------

Co-authored-by: Davide Giacometti <davide.giacometti@outlook.it>
2023-11-20 10:23:26 +00:00

207 lines
11 KiB
XML

<UserControl
x:Class="PowerLauncher.ResultList"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Behaviors="http://schemas.microsoft.com/xaml/behaviors"
xmlns:converters="clr-namespace:PowerLauncher.Converters"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:helper="clr-namespace:PowerLauncher.Helper"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:p="clr-namespace:PowerLauncher.Properties"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
xmlns:viewmodel="clr-namespace:PowerLauncher.ViewModel"
d:DesignHeight="300"
d:DesignWidth="720"
mc:Ignorable="d">
<UserControl.Resources>
<ResourceDictionary>
<converters:HighlightTextConverter x:Key="highlightTextConverter" />
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
<Style x:Key="FocusVisual">
<Setter Property="Control.Template">
<Setter.Value>
<ControlTemplate>
<Rectangle
Margin="2"
SnapsToDevicePixels="true"
Stroke="{DynamicResource FocusStrokeColorOuterBrush}"
StrokeDashArray="1 2"
StrokeThickness="1" />
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style
x:Key="CollapsableTextblock"
BasedOn="{StaticResource CaptionTextBlockStyle}"
TargetType="TextBlock">
<Style.Triggers>
<Trigger Property="Text" Value="">
<Setter Property="Visibility" Value="Collapsed" />
</Trigger>
</Style.Triggers>
</Style>
</ResourceDictionary>
</UserControl.Resources>
<ListView
x:Name="SuggestionsList"
Margin="0,12,0,0"
x:FieldModifier="public"
AutomationProperties.Name="{x:Static p:Resources.Results}"
ItemsSource="{Binding Results.Results, Mode=OneWay}"
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
ScrollViewer.VerticalScrollBarVisibility="Auto"
SelectedIndex="{Binding Results.SelectedIndex, Mode=TwoWay}"
SelectionChanged="SuggestionsListView_SelectionChanged"
SelectionMode="Single">
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel
Margin="12,6,0,0"
IsVirtualizing="{TemplateBinding VirtualizingPanel.IsVirtualizing}"
VirtualizationMode="{TemplateBinding VirtualizingPanel.VirtualizationMode}" />
</ItemsPanelTemplate>
</ListView.ItemsPanel>
<!--
AllowFocusOnInteraction="False"
IsItemClickEnabled="True"
-->
<!-- Style="{StaticResource ListViewNoAnimations}" -->
<ListView.ItemTemplate>
<DataTemplate>
<Grid
Height="40"
Background="Transparent"
ToolTipService.BetweenShowDelay="0"
ToolTipService.InitialShowDelay="1000">
<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="48" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ToolTip>
<ToolTip Opened="ToolTip_Opened" Visibility="{Binding Result.ToolTipVisibility}">
<StackPanel>
<TextBlock
FontWeight="Bold"
Style="{DynamicResource CollapsableTextblock}"
Text="{Binding Result.ToolTipData.Title}"
TextWrapping="Wrap" />
<TextBlock
Margin="0,4,0,0"
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
Style="{DynamicResource CollapsableTextblock}"
Text="{Binding Result.ToolTipData.Text}"
TextWrapping="Wrap" />
</StackPanel>
</ToolTip>
</Grid.ToolTip>
<Image
x:Name="AppIcon"
Grid.RowSpan="2"
Height="24"
MaxWidth="56"
Margin="-6,-2,0,0"
HorizontalAlignment="Center"
AutomationProperties.Name="{x:Static p:Resources.AppIcon}"
Source="{Binding Image}" />
<TextBlock
x:Name="Title"
Grid.Column="1"
VerticalAlignment="Bottom"
AutomationProperties.Name="{x:Static p:Resources.Title}"
FontSize="14"
IsHitTestVisible="False"
TextTrimming="CharacterEllipsis">
<viewmodel:ResultsViewModel.FormattedText>
<MultiBinding Converter="{StaticResource highlightTextConverter}">
<Binding Path="Result.Title" />
<Binding Path="Result.TitleHighlightData" />
<Binding Path="IsSelected" RelativeSource="{RelativeSource Mode=FindAncestor, AncestorType={x:Type ListViewItem}}" />
</MultiBinding>
</viewmodel:ResultsViewModel.FormattedText>
</TextBlock>
<TextBlock
x:Name="Path"
Grid.Row="1"
Grid.Column="1"
Margin="0,0,0,0"
VerticalAlignment="Top"
AutomationProperties.Name="{x:Static p:Resources.Subtitle}"
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
Style="{StaticResource CaptionTextBlockStyle}"
Text="{Binding Result.SubTitle}"
TextTrimming="CharacterEllipsis" />
<ListView
Grid.RowSpan="2"
Grid.Column="2"
HorizontalAlignment="Right"
VerticalAlignment="Center"
AutomationProperties.Name="{x:Static p:Resources.ContextMenuItemsCollection}"
Background="Transparent"
BorderThickness="0"
ItemContainerStyle="{StaticResource CommandButtonListViewItemContainerStyle}"
ItemsSource="{Binding ContextMenuItems}"
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
ScrollViewer.VerticalScrollBarVisibility="Disabled"
SelectedIndex="{Binding ContextMenuSelectedIndex}"
SelectionChanged="ContextMenuListView_SelectionChanged"
SelectionMode="Single"
Visibility="{Binding AreContextButtonsActive, Converter={StaticResource BooleanToVisibilityConverter}}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel
HorizontalAlignment="Center"
VerticalAlignment="Center"
Orientation="Horizontal" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ListView.ItemTemplate>
<DataTemplate>
<Button
Name="commandButton"
Width="42"
Height="42"
VerticalAlignment="Center"
AutomationProperties.Name="{x:Static p:Resources.ContextMenuItem}"
BorderThickness="1"
Command="{Binding Command}"
Style="{StaticResource SubtleButtonStyle}">
<ToolTipService.ToolTip>
<ToolTip Opened="ToolTip_Opened">
<TextBlock
AutomationProperties.Name="{x:Static p:Resources.ContextMenuItemAdditionalInformation}"
Foreground="{DynamicResource TextFillColorPrimaryBrush}"
Text="{Binding Title}" />
</ToolTip>
</ToolTipService.ToolTip>
<Button.Content>
<ui:FontIcon
AutomationProperties.Name="{x:Static p:Resources.ContextMenuIcon}"
FontFamily="{Binding FontFamily}"
Glyph="{Binding Glyph}" />
</Button.Content>
</Button>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</Grid>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</UserControl>