Blurry Text for PT Run improvements (#6049)

* Checking in adjustments based off @anuthadev pr's

* Forcing an improvement on the magnifier glass

* removing whitespace
This commit is contained in:
Clint Rutkas 2020-08-20 21:45:55 -07:00 committed by GitHub
parent 9b567f9ba3
commit cc0b808962
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 66 additions and 55 deletions

View File

@ -4,13 +4,12 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:PowerLauncher"
mc:Ignorable="d" mc:Ignorable="d"
d:DesignHeight="300" d:DesignHeight="300"
d:DesignWidth="720"> d:DesignWidth="720">
<UserControl.Resources> <UserControl.Resources>
<Style x:Key="QueryTextBoxStyle" TargetType="{x:Type TextBox}"> <Style x:Key="QueryTextBoxStyle" TargetType="{x:Type TextBox}">
<Setter Property="Background" Value="Transparent" /> <Setter Property="Background" Value="{DynamicResource SystemChromeLow}" />
<Setter Property="BorderThickness" Value="0" /> <Setter Property="BorderThickness" Value="0" />
<Setter Property="Foreground" Value="{DynamicResource ControlTextBrushKey}"/> <Setter Property="Foreground" Value="{DynamicResource ControlTextBrushKey}"/>
<Setter Property="CaretBrush" Value="{DynamicResource ControlTextBrushKey}"/> <Setter Property="CaretBrush" Value="{DynamicResource ControlTextBrushKey}"/>
@ -25,7 +24,18 @@
<Setter.Value> <Setter.Value>
<ControlTemplate TargetType="{x:Type TextBox}"> <ControlTemplate TargetType="{x:Type TextBox}">
<Grid> <Grid>
<TextBlock Margin="15, 1, 0, 0" Text="{TemplateBinding Tag}"> <Border x:Name="border" Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" SnapsToDevicePixels="True">
<ScrollViewer x:Name="PART_ContentHost" Background="{TemplateBinding Background}" Focusable="false" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden">
<ScrollViewer.ContentTemplate>
<DataTemplate>
<Grid Background="{Binding Background, ElementName=PART_ContentHost}" RenderOptions.ClearTypeHint="Enabled" TextOptions.TextFormattingMode="Display">
<ContentPresenter Content="{Binding Path=Content, ElementName=PART_ContentHost}"/>
</Grid>
</DataTemplate>
</ScrollViewer.ContentTemplate>
</ScrollViewer>
</Border>
<TextBlock Margin="14, 0, 0, 0" Text="{TemplateBinding Tag}">
<TextBlock.Style> <TextBlock.Style>
<Style TargetType="{x:Type TextBlock}"> <Style TargetType="{x:Type TextBlock}">
<Setter Property="Foreground" Value="Transparent"/> <Setter Property="Foreground" Value="Transparent"/>
@ -37,9 +47,6 @@
</Style> </Style>
</TextBlock.Style> </TextBlock.Style>
</TextBlock> </TextBlock>
<Border x:Name="border" Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" SnapsToDevicePixels="True">
<ScrollViewer x:Name="PART_ContentHost" Focusable="false" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden"/>
</Border>
</Grid> </Grid>
<ControlTemplate.Triggers> <ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="false"> <Trigger Property="IsEnabled" Value="false">
@ -75,22 +82,10 @@
<ColumnDefinition Width="72"/> <ColumnDefinition Width="72"/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<TextBlock
x:Name="AutoCompleteTextBlock"
x:FieldModifier="public"
Opacity="0.6"
Canvas.ZIndex="0"
Margin="24, 0, 14, 0"
VerticalAlignment="Center"
FontSize="24"
Foreground="{DynamicResource TextControlPlaceholderForeground}"
/>
<!-- <!--
for adding on placeholder, look at the style with 90 votes for adding on placeholder, look at the style with 90 votes
https://stackoverflow.com/questions/11873378/adding-placeholder-text-to-textbox https://stackoverflow.com/questions/11873378/adding-placeholder-text-to-textbox
--> -->
<TextBox <TextBox
AutomationProperties.Name="{DynamicResource Query}" AutomationProperties.Name="{DynamicResource Query}"
x:Name="QueryTextBox" x:Name="QueryTextBox"
@ -101,16 +96,30 @@
FontSize="24" FontSize="24"
Style="{StaticResource QueryTextBoxStyle}" Style="{StaticResource QueryTextBoxStyle}"
Tag="{DynamicResource startTyping}" Tag="{DynamicResource startTyping}"
RenderOptions.ClearTypeHint="Enabled"
/> />
<TextBlock
x:Name="AutoCompleteTextBlock"
x:FieldModifier="public"
Opacity="0.6"
Canvas.ZIndex="0"
Margin="24, 0, 14, 0"
VerticalAlignment="Center"
FontSize="24"
Foreground="{DynamicResource TextControlPlaceholderForeground}"
RenderOptions.ClearTypeHint="Enabled"
/>
<TextBlock <TextBlock
AutomationProperties.Name="{DynamicResource SearchIcon}" AutomationProperties.Name="{DynamicResource SearchIcon}"
Grid.Column="1" Grid.Column="1"
Text="&#xE721;" Text="&#xE721;"
FontFamily="Segoe MDL2 Assets" FontFamily="Segoe MDL2 Assets"
FontSize="24" FontSize="26"
HorizontalAlignment="Center" HorizontalAlignment="Center"
VerticalAlignment="Center" VerticalAlignment="Center"
Foreground="{DynamicResource TextControlPlaceholderForeground}" /> Foreground="{DynamicResource TextControlPlaceholderForeground}"
RenderOptions.ClearTypeHint="Enabled"
TextOptions.TextRenderingMode="Auto"
SnapsToDevicePixels="True"/>
</Grid> </Grid>
</UserControl> </UserControl>

View File

@ -10,6 +10,8 @@
Topmost="True" Topmost="True"
SizeToContent="Height" SizeToContent="Height"
ResizeMode="NoResize" ResizeMode="NoResize"
TextOptions.TextRenderingMode="ClearType"
RenderOptions.ClearTypeHint="Enabled"
WindowStyle="None" WindowStyle="None"
WindowStartupLocation="Manual" WindowStartupLocation="Manual"
AllowDrop="True" AllowDrop="True"
@ -24,6 +26,7 @@
Deactivated="OnDeactivated" Deactivated="OnDeactivated"
IsVisibleChanged="OnVisibilityChanged" IsVisibleChanged="OnVisibilityChanged"
Visibility="{Binding MainWindowVisibility, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Visibility="{Binding MainWindowVisibility, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
d:DataContext="{d:DesignInstance vm:MainViewModel}"> d:DataContext="{d:DesignInstance vm:MainViewModel}">
<Window.Resources> <Window.Resources>
<CubicEase x:Key="CubicEaseOut" EasingMode="EaseOut"/> <CubicEase x:Key="CubicEaseOut" EasingMode="EaseOut"/>
@ -52,17 +55,15 @@
<RowDefinition Height="Auto"/> <RowDefinition Height="Auto"/>
<RowDefinition Height="*"/> <RowDefinition Height="*"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Border <Grid
x:Name="SearchBoxBorder" x:Name="SearchBoxBorder"
Grid.Row="0" Grid.Row="0"
Margin="24,24,24,24" Margin="24,24,24,24">
BorderThickness="1" <Rectangle Fill="{DynamicResource SystemChromeLow}" RadiusX="4" RadiusY="4" Stroke="{DynamicResource BorderBrush}" StrokeThickness="1">
CornerRadius="4" <Rectangle.Effect>
Background="{DynamicResource SystemChromeLow}" <DropShadowEffect BlurRadius="32" Opacity="0.28" ShadowDepth="1" />
BorderBrush="{DynamicResource BorderBrush}"> </Rectangle.Effect>
<Border.Effect> </Rectangle>
<DropShadowEffect BlurRadius="32" Opacity="0.28" ShadowDepth="1" />
</Border.Effect>
<local:LauncherControl <local:LauncherControl
x:Name="SearchBox"> x:Name="SearchBox">
<!--<local:LauncherControl.RenderTransform> <!--<local:LauncherControl.RenderTransform>
@ -72,29 +73,28 @@
<!--<Border.RenderTransform> <!--<Border.RenderTransform>
<TranslateTransform /> <TranslateTransform />
</Border.RenderTransform>--> </Border.RenderTransform>-->
</Border> </Grid>
<Border <Grid
x:Name="ListBoxBorder" x:Name="ListBoxBorder"
Grid.Row="1" Grid.Row="1"
Margin="24,-8,24,24" Margin="24,-8,24,24"
BorderThickness="1" Visibility="{Binding Results.Visibility}">
CornerRadius="4"
Visibility="{Binding Results.Visibility}"
Background="{DynamicResource SystemChromeLow}"
BorderBrush="{DynamicResource BorderBrush}">
<!--<Border.RenderTransform> <!--<Border.RenderTransform>
<TranslateTransform /> <TranslateTransform />
</Border.RenderTransform>--> </Border.RenderTransform>-->
<Border.Effect> <Rectangle RadiusX="4" RadiusY="4" Fill="{DynamicResource SystemChromeLow}" Stroke="{DynamicResource BorderBrush}" StrokeThickness="1">
<DropShadowEffect BlurRadius="32" Opacity="0.28" ShadowDepth="1" /> <Rectangle.Effect>
</Border.Effect> <DropShadowEffect BlurRadius="32" Opacity="0.28" ShadowDepth="1" />
</Rectangle.Effect>
</Rectangle>
<local:ResultList x:Name="ListBox" <local:ResultList x:Name="ListBox"
PreviewMouseDown="ListBox_PreviewMouseDown" > PreviewMouseDown="ListBox_PreviewMouseDown" >
<!--<local:ResultList.RenderTransform> <!--<local:ResultList.RenderTransform>
<TranslateTransform /> <TranslateTransform />
</local:ResultList.RenderTransform>--> </local:ResultList.RenderTransform>-->
</local:ResultList> </local:ResultList>
</Border> <Rectangle RadiusX="4" RadiusY="4" Stroke="{DynamicResource SystemChromeLow}" StrokeThickness="1" />
</Grid>
</Grid> </Grid>
<Window.InputBindings> <Window.InputBindings>
<KeyBinding Key="Escape" Command="{Binding EscCommand}" /> <KeyBinding Key="Escape" Command="{Binding EscCommand}" />

View File

@ -71,7 +71,7 @@
<Setter.Value> <Setter.Value>
<ControlTemplate TargetType="{x:Type ListViewItem}"> <ControlTemplate TargetType="{x:Type ListViewItem}">
<Grid Background="Transparent"> <Grid Background="Transparent">
<Border x:Name="HighlightBorder" BorderThickness="0" Background="Transparent" BorderBrush="Transparent" SnapsToDevicePixels="true"/> <Border x:Name="HighlightBorder" BorderThickness="0" 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}"/> <ContentPresenter x:Name="contentPresenter" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Grid> </Grid>
<ControlTemplate.Triggers> <ControlTemplate.Triggers>
@ -95,6 +95,7 @@
<Style x:Key="CommandButtonListViewItemContainerStyle" TargetType="ListViewItem"> <Style x:Key="CommandButtonListViewItemContainerStyle" TargetType="ListViewItem">
<Setter Property="Background" Value="Transparent" /> <Setter Property="Background" Value="Transparent" />
<Setter Property="Padding" Value="0" /> <Setter Property="Padding" Value="0" />
<Setter Property="Margin" Value="1" />
<Setter Property="Template"> <Setter Property="Template">
<Setter.Value> <Setter.Value>
<ControlTemplate TargetType="{x:Type ListViewItem}"> <ControlTemplate TargetType="{x:Type ListViewItem}">
@ -134,11 +135,10 @@
<Setter Property="Template"> <Setter Property="Template">
<Setter.Value> <Setter.Value>
<ControlTemplate TargetType="{x:Type ToolTip}" > <ControlTemplate TargetType="{x:Type ToolTip}" >
<StackPanel Margin="8,2" > <Grid Margin="8,2" >
<Border CornerRadius="4" Background="{DynamicResource ToolTipBackgroundBrushKey}" BorderBrush="{DynamicResource ToolTipBorderBrushKey}" BorderThickness="1"> <Rectangle Fill="{DynamicResource ToolTipBackgroundBrushKey}" RadiusX="4" RadiusY="4" Stroke="{DynamicResource ToolTipBorderBrushKey}" StrokeThickness="1"/>
<ContentPresenter Margin="4" HorizontalAlignment="Center" VerticalAlignment="Top" /> <ContentPresenter Margin="4" HorizontalAlignment="Center" VerticalAlignment="Top" />
</Border> </Grid>
</StackPanel>
</ControlTemplate> </ControlTemplate>
</Setter.Value> </Setter.Value>
</Setter> </Setter>
@ -199,18 +199,20 @@
Style="{DynamicResource CollapsableTextblock}" Style="{DynamicResource CollapsableTextblock}"
Foreground="{DynamicResource ToolTipForegroundBrushKey}" FontWeight="Bold" FontSize="12" Foreground="{DynamicResource ToolTipForegroundBrushKey}" FontWeight="Bold" FontSize="12"
Text="{Binding Result.ToolTipData.Title}" Text="{Binding Result.ToolTipData.Title}"
TextWrapping="Wrap" /> TextWrapping="Wrap"
RenderOptions.ClearTypeHint="Enabled" />
<TextBlock <TextBlock
Style="{DynamicResource CollapsableTextblock}" Style="{DynamicResource CollapsableTextblock}"
Foreground="{DynamicResource ToolTipForegroundBrushKey}" FontSize="12" Foreground="{DynamicResource ToolTipForegroundBrushKey}" FontSize="12"
Text="{Binding Result.ToolTipData.Text}" Text="{Binding Result.ToolTipData.Text}"
TextWrapping="Wrap" /> TextWrapping="Wrap"
RenderOptions.ClearTypeHint="Enabled" />
</StackPanel> </StackPanel>
</ToolTip> </ToolTip>
</Grid.ToolTip> </Grid.ToolTip>
<Image AutomationProperties.Name="{DynamicResource AppIcon}" x:Name="AppIcon" Height="36" MaxWidth="56" Grid.RowSpan="2" Margin="-6,-2,0,0" HorizontalAlignment="Center" Source="{Binding Image}" /> <Image AutomationProperties.Name="{DynamicResource AppIcon}" x:Name="AppIcon" Height="36" MaxWidth="56" Grid.RowSpan="2" Margin="-6,-2,0,0" HorizontalAlignment="Center" Source="{Binding Image}" />
<TextBlock AutomationProperties.Name="{DynamicResource Title}" x:Name="Title" Grid.Column="1" Text="{Binding Result.Title}" FontWeight="SemiBold" FontSize="20" Margin="0,0,0,-2" VerticalAlignment="Bottom"/> <TextBlock AutomationProperties.Name="{DynamicResource Title}" x:Name="Title" Grid.Column="1" Text="{Binding Result.Title}" FontWeight="SemiBold" FontSize="20" Margin="0,0,0,-2" VerticalAlignment="Bottom" RenderOptions.ClearTypeHint="Enabled"/>
<TextBlock AutomationProperties.Name="{DynamicResource Subtitle}" x:Name="Path" Grid.Column="1" Text= "{Binding Result.SubTitle}" Grid.Row="1" Foreground="{DynamicResource SecondaryTextForeground}" Margin="0,2,0,0" VerticalAlignment="Top"/> <TextBlock AutomationProperties.Name="{DynamicResource Subtitle}" x:Name="Path" Grid.Column="1" Text= "{Binding Result.SubTitle}" Grid.Row="1" Foreground="{DynamicResource SecondaryTextForeground}" Margin="0,2,0,0" VerticalAlignment="Top" RenderOptions.ClearTypeHint="Enabled"/>
<ListView <ListView
AutomationProperties.Name="{DynamicResource ContextMenuItemsCollection}" AutomationProperties.Name="{DynamicResource ContextMenuItemsCollection}"
HorizontalAlignment="Right" HorizontalAlignment="Right"
@ -239,11 +241,11 @@
<Button AutomationProperties.Name="{DynamicResource ContextMenuItem}" Style="{StaticResource IconButtonStyle}" Command="{Binding Command}" VerticalAlignment="Center" Height="42" Width="42" BorderThickness="1" > <Button AutomationProperties.Name="{DynamicResource ContextMenuItem}" Style="{StaticResource IconButtonStyle}" Command="{Binding Command}" VerticalAlignment="Center" Height="42" Width="42" BorderThickness="1" >
<ToolTipService.ToolTip> <ToolTipService.ToolTip>
<ToolTip > <ToolTip >
<TextBlock AutomationProperties.Name="{DynamicResource ContextMenuItemAdditionalInformation}" Text="{Binding Title}" Foreground="{DynamicResource ToolTipForegroundBrushKey}" Margin="8,5" FontSize="12"/> <TextBlock AutomationProperties.Name="{DynamicResource ContextMenuItemAdditionalInformation}" Text="{Binding Title}" Foreground="{DynamicResource ToolTipForegroundBrushKey}" Margin="8,5" FontSize="12" RenderOptions.ClearTypeHint="Enabled"/>
</ToolTip> </ToolTip>
</ToolTipService.ToolTip> </ToolTipService.ToolTip>
<Button.Content> <Button.Content>
<TextBlock AutomationProperties.Name="{DynamicResource ContextMenuIcon}" FontFamily="{Binding FontFamily}" FontSize="16" Text="{Binding Glyph}"/> <TextBlock AutomationProperties.Name="{DynamicResource ContextMenuIcon}" FontFamily="{Binding FontFamily}" FontSize="16" Text="{Binding Glyph}" RenderOptions.ClearTypeHint="Enabled"/>
</Button.Content> </Button.Content>
</Button> </Button>
</DataTemplate> </DataTemplate>