2020-05-13 06:42:21 +08:00
|
|
|
<UserControl
|
|
|
|
x:Class="PowerLauncher.LauncherControl"
|
|
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
|
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
|
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
2020-09-03 06:24:59 +08:00
|
|
|
xmlns:p="clr-namespace:PowerLauncher.Properties"
|
2020-09-03 04:34:07 +08:00
|
|
|
xmlns:local="clr-namespace:PowerLauncher"
|
2020-05-13 06:42:21 +08:00
|
|
|
mc:Ignorable="d"
|
|
|
|
d:DesignHeight="300"
|
|
|
|
d:DesignWidth="720">
|
|
|
|
<UserControl.Resources>
|
|
|
|
<Style x:Key="QueryTextBoxStyle" TargetType="{x:Type TextBox}">
|
2020-08-29 08:18:46 +08:00
|
|
|
<Setter Property="Background" Value="Transparent" />
|
2020-05-13 06:42:21 +08:00
|
|
|
<Setter Property="BorderThickness" Value="0" />
|
2020-06-06 00:58:30 +08:00
|
|
|
<Setter Property="Foreground" Value="{DynamicResource ControlTextBrushKey}"/>
|
|
|
|
<Setter Property="CaretBrush" Value="{DynamicResource ControlTextBrushKey}"/>
|
2020-05-13 06:42:21 +08:00
|
|
|
<Setter Property="KeyboardNavigation.TabNavigation" Value="None"/>
|
|
|
|
<Setter Property="HorizontalContentAlignment" Value="Left"/>
|
|
|
|
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
|
|
|
|
<Setter Property="AllowDrop" Value="true"/>
|
|
|
|
<Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst"/>
|
|
|
|
<Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
|
|
|
|
<Setter Property="Padding" Value="12,0,0,0" />
|
|
|
|
<Setter Property="Template">
|
|
|
|
<Setter.Value>
|
|
|
|
<ControlTemplate TargetType="{x:Type TextBox}">
|
|
|
|
<Grid>
|
2020-10-09 11:14:00 +08:00
|
|
|
<TextBlock Margin="14, 0, 0, 0"
|
|
|
|
Text="{TemplateBinding Tag}">
|
2020-05-13 06:42:21 +08:00
|
|
|
<TextBlock.Style>
|
|
|
|
<Style TargetType="{x:Type TextBlock}">
|
|
|
|
<Setter Property="Foreground" Value="Transparent"/>
|
|
|
|
<Style.Triggers>
|
|
|
|
<DataTrigger Binding="{Binding Path=Text, RelativeSource={RelativeSource TemplatedParent}}" Value="">
|
2020-06-02 03:35:37 +08:00
|
|
|
<Setter Property="Foreground" Value="{DynamicResource TextControlPlaceholderForeground}"/>
|
2020-05-13 06:42:21 +08:00
|
|
|
</DataTrigger>
|
|
|
|
</Style.Triggers>
|
|
|
|
</Style>
|
|
|
|
</TextBlock.Style>
|
|
|
|
</TextBlock>
|
2020-10-09 11:14:00 +08:00
|
|
|
<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">
|
2020-09-11 00:42:20 +08:00
|
|
|
<ScrollViewer.ContentTemplate>
|
|
|
|
<DataTemplate>
|
2020-10-09 11:14:00 +08:00
|
|
|
<Grid
|
|
|
|
Background="{Binding Background, ElementName=PART_ContentHost}"
|
|
|
|
RenderOptions.ClearTypeHint="Enabled"
|
|
|
|
TextOptions.TextFormattingMode="Display">
|
2020-09-11 00:42:20 +08:00
|
|
|
<ContentPresenter Content="{Binding Path=Content, ElementName=PART_ContentHost}"/>
|
|
|
|
</Grid>
|
|
|
|
</DataTemplate>
|
|
|
|
</ScrollViewer.ContentTemplate>
|
|
|
|
</ScrollViewer>
|
|
|
|
</Border>
|
2020-05-13 06:42:21 +08:00
|
|
|
</Grid>
|
|
|
|
<ControlTemplate.Triggers>
|
|
|
|
<Trigger Property="IsEnabled" Value="false">
|
|
|
|
<Setter Property="Opacity" TargetName="border" Value="0.56"/>
|
|
|
|
</Trigger>
|
|
|
|
<Trigger Property="IsMouseOver" Value="true">
|
|
|
|
<Setter Property="BorderBrush" TargetName="border" Value="{StaticResource TextBox.MouseOver.Border}"/>
|
|
|
|
</Trigger>
|
|
|
|
<Trigger Property="IsKeyboardFocused" Value="true">
|
|
|
|
<Setter Property="BorderBrush" TargetName="border" Value="{StaticResource TextBox.Focus.Border}"/>
|
|
|
|
</Trigger>
|
|
|
|
</ControlTemplate.Triggers>
|
|
|
|
</ControlTemplate>
|
|
|
|
</Setter.Value>
|
|
|
|
</Setter>
|
|
|
|
<Style.Triggers>
|
|
|
|
<MultiTrigger>
|
|
|
|
<MultiTrigger.Conditions>
|
|
|
|
<Condition Property="IsInactiveSelectionHighlightEnabled" Value="true"/>
|
|
|
|
<Condition Property="IsSelectionActive" Value="false"/>
|
|
|
|
</MultiTrigger.Conditions>
|
2020-06-06 00:58:30 +08:00
|
|
|
<Setter Property="SelectionBrush" Value="{DynamicResource InactiveSelectionHighlightBrushKey}"/>
|
2020-05-13 06:42:21 +08:00
|
|
|
</MultiTrigger>
|
|
|
|
</Style.Triggers>
|
|
|
|
</Style>
|
|
|
|
</UserControl.Resources>
|
|
|
|
<Grid
|
2020-06-02 03:35:37 +08:00
|
|
|
Height="68"
|
2020-05-13 06:42:21 +08:00
|
|
|
VerticalAlignment="Top">
|
|
|
|
<!--Background="{ThemeResource BackdropAcrylicBrush}"-->
|
|
|
|
<Grid.ColumnDefinitions>
|
|
|
|
<ColumnDefinition Width="*"/>
|
2020-06-27 07:12:26 +08:00
|
|
|
<ColumnDefinition Width="72"/>
|
2020-05-13 06:42:21 +08:00
|
|
|
</Grid.ColumnDefinitions>
|
|
|
|
|
|
|
|
<!--
|
|
|
|
for adding on placeholder, look at the style with 90 votes
|
|
|
|
https://stackoverflow.com/questions/11873378/adding-placeholder-text-to-textbox
|
|
|
|
-->
|
2020-09-03 04:34:07 +08:00
|
|
|
<local:CustomSearchBox
|
2020-09-03 06:24:59 +08:00
|
|
|
AutomationProperties.Name="{x:Static p:Resources.Query}"
|
2020-05-13 06:42:21 +08:00
|
|
|
x:Name="QueryTextBox"
|
|
|
|
x:FieldModifier="public"
|
|
|
|
Canvas.ZIndex="0"
|
|
|
|
Margin="10, 0, 0, 0"
|
|
|
|
VerticalAlignment="Center"
|
|
|
|
FontSize="24"
|
|
|
|
Style="{StaticResource QueryTextBoxStyle}"
|
2020-09-03 06:24:59 +08:00
|
|
|
Tag="{x:Static p:Resources.startTyping}"
|
2020-08-21 12:45:55 +08:00
|
|
|
RenderOptions.ClearTypeHint="Enabled"
|
2020-05-13 06:42:21 +08:00
|
|
|
/>
|
2020-08-21 12:45:55 +08:00
|
|
|
<TextBlock
|
|
|
|
x:Name="AutoCompleteTextBlock"
|
|
|
|
x:FieldModifier="public"
|
|
|
|
Opacity="0.6"
|
2020-08-29 08:18:46 +08:00
|
|
|
Canvas.ZIndex="-1"
|
2020-08-21 12:45:55 +08:00
|
|
|
Margin="24, 0, 14, 0"
|
|
|
|
VerticalAlignment="Center"
|
|
|
|
FontSize="24"
|
|
|
|
Foreground="{DynamicResource TextControlPlaceholderForeground}"
|
2020-08-29 08:18:46 +08:00
|
|
|
Background="{DynamicResource SystemChromeLow}"
|
2020-08-21 12:45:55 +08:00
|
|
|
RenderOptions.ClearTypeHint="Enabled"
|
|
|
|
/>
|
2020-05-13 06:42:21 +08:00
|
|
|
<TextBlock
|
2020-09-03 06:24:59 +08:00
|
|
|
AutomationProperties.Name="{x:Static p:Resources.SearchIcon}"
|
2020-05-13 06:42:21 +08:00
|
|
|
Grid.Column="1"
|
|
|
|
Text=""
|
|
|
|
FontFamily="Segoe MDL2 Assets"
|
2020-08-21 12:45:55 +08:00
|
|
|
FontSize="26"
|
2020-06-02 03:35:37 +08:00
|
|
|
HorizontalAlignment="Center"
|
2020-05-13 06:42:21 +08:00
|
|
|
VerticalAlignment="Center"
|
2020-08-21 12:45:55 +08:00
|
|
|
Foreground="{DynamicResource TextControlPlaceholderForeground}"
|
|
|
|
RenderOptions.ClearTypeHint="Enabled"
|
|
|
|
TextOptions.TextRenderingMode="Auto"
|
|
|
|
SnapsToDevicePixels="True"/>
|
2020-05-13 06:42:21 +08:00
|
|
|
</Grid>
|
2020-10-09 11:14:00 +08:00
|
|
|
</UserControl>
|