mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-01-18 06:29:44 +08:00
Added Neils UI code
This commit is contained in:
parent
b8e957ff9a
commit
64a4451868
@ -1,18 +1,487 @@
|
||||
<UserControl
|
||||
x:Class="PowerLauncher.UI.LauncherControl"
|
||||
x:Class="PowerToysUX.Controls.PowerLaunch"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:PowerLauncher.UI"
|
||||
xmlns:local="using:PowerToysUX.Controls"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d"
|
||||
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
|
||||
xmlns:ToolkitBehaviors="using:Microsoft.Toolkit.Uwp.UI.Animations.Behaviors"
|
||||
xmlns:Core="using:Microsoft.Xaml.Interactions.Core"
|
||||
xmlns:Behaviors="using:PowerToysUX.Behaviours"
|
||||
xmlns:Interactivity="using:Microsoft.Xaml.Interactivity"
|
||||
d:DesignHeight="300"
|
||||
d:DesignWidth="400">
|
||||
<UserControl.Resources>
|
||||
|
||||
<Style TargetType="AutoSuggestBox" x:Name="CustomStyledAutoSuggestBox">
|
||||
<Setter Property="VerticalAlignment" Value="Top" />
|
||||
<Setter Property="IsTabStop" Value="False" />
|
||||
<Setter Property="TextBoxStyle" Value="{StaticResource AutoSuggestBoxTextBoxStyle}" />
|
||||
<Setter Property="UseSystemFocusVisuals" Value="{ThemeResource IsApplicationFocusVisualKindReveal}" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="AutoSuggestBox">
|
||||
<Grid x:Name="LayoutRoot">
|
||||
|
||||
<VisualStateManager.VisualStateGroups>
|
||||
<VisualStateGroup x:Name="Orientation">
|
||||
<VisualState x:Name="Landscape" />
|
||||
<VisualState x:Name="Portrait" />
|
||||
|
||||
</VisualStateGroup>
|
||||
|
||||
</VisualStateManager.VisualStateGroups>
|
||||
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<TextBox x:Name="TextBox"
|
||||
Style="{StaticResource CustomAutoSuggestBoxTextBoxStyle}"
|
||||
PlaceholderText="{TemplateBinding PlaceholderText}"
|
||||
Header="{TemplateBinding Header}" Height="72"
|
||||
Width="{TemplateBinding Width}"
|
||||
Description="{TemplateBinding Description}"
|
||||
ScrollViewer.BringIntoViewOnFocusChange="False"
|
||||
Canvas.ZIndex="0"
|
||||
Margin="0" VerticalAlignment="Center"
|
||||
FontSize="24"
|
||||
DesiredCandidateWindowAlignment="BottomEdge"
|
||||
UseSystemFocusVisuals="{TemplateBinding UseSystemFocusVisuals}" />
|
||||
|
||||
<Popup x:Name="SuggestionsPopup" Margin="0,24,0,0">
|
||||
<Border x:Name="SuggestionsContainer">
|
||||
<ListView x:Name="SuggestionsList"
|
||||
Background="{ThemeResource AutoSuggestBoxSuggestionsListBackground}"
|
||||
BorderThickness="{ThemeResource AutoSuggestListBorderThemeThickness}"
|
||||
BorderBrush="{ThemeResource AutoSuggestBoxSuggestionsListBorderBrush}"
|
||||
DisplayMemberPath="{TemplateBinding DisplayMemberPath}"
|
||||
IsItemClickEnabled="True"
|
||||
ItemTemplate="{TemplateBinding ItemTemplate}"
|
||||
ItemTemplateSelector="{TemplateBinding ItemTemplateSelector}"
|
||||
ItemContainerStyle="{TemplateBinding ItemContainerStyle}"
|
||||
MaxHeight="{ThemeResource AutoSuggestListMaxHeight}"
|
||||
Margin="{ThemeResource AutoSuggestListMargin}"
|
||||
Padding="{ThemeResource AutoSuggestListPadding}" />
|
||||
</Border>
|
||||
</Popup>
|
||||
|
||||
</Grid>
|
||||
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="TextBox" x:Key="CustomAutoSuggestBoxTextBoxStyle">
|
||||
<Setter Property="MinWidth" Value="{ThemeResource TextControlThemeMinWidth}" />
|
||||
<Setter Property="MinHeight" Value="{ThemeResource TextControlThemeMinHeight}" />
|
||||
<Setter Property="Foreground" Value="{ThemeResource TextControlForeground}" />
|
||||
<Setter Property="Background" Value="{ThemeResource TextControlBackground}" />
|
||||
<Setter Property="BorderBrush" Value="{ThemeResource TextControlBorderBrush}" />
|
||||
<Setter Property="SelectionHighlightColor" Value="{ThemeResource TextControlSelectionHighlightColor}" />
|
||||
<Setter Property="BorderThickness" Value="0" />
|
||||
<Setter Property="FontFamily" Value="{ThemeResource ContentControlThemeFontFamily}" />
|
||||
<Setter Property="FontSize" Value="{ThemeResource ControlContentThemeFontSize}" />
|
||||
<Setter Property="ScrollViewer.HorizontalScrollMode" Value="Auto" />
|
||||
<Setter Property="ScrollViewer.VerticalScrollMode" Value="Auto" />
|
||||
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Hidden" />
|
||||
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Hidden" />
|
||||
<Setter Property="ScrollViewer.IsDeferredScrollingEnabled" Value="False" />
|
||||
<Setter Property="Padding" Value="{ThemeResource TextControlThemePadding}" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="TextBox">
|
||||
<Grid>
|
||||
|
||||
<Grid.Resources>
|
||||
<Style x:Name="DeleteButtonStyle" TargetType="Button">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="Button">
|
||||
<Grid x:Name="ButtonLayoutGrid"
|
||||
BorderBrush="{ThemeResource TextControlButtonBorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
Background="{ThemeResource TextControlButtonBackground}">
|
||||
|
||||
<VisualStateManager.VisualStateGroups>
|
||||
<VisualStateGroup x:Name="CommonStates">
|
||||
<VisualState x:Name="Normal" />
|
||||
|
||||
<VisualState x:Name="PointerOver">
|
||||
<Storyboard>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ButtonLayoutGrid" Storyboard.TargetProperty="Background">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="Transparent" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<!--<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ButtonLayoutGrid" Storyboard.TargetProperty="BorderBrush">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlButtonBorderBrushPointerOver}" />
|
||||
</ObjectAnimationUsingKeyFrames>-->
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="GlyphElement" Storyboard.TargetProperty="Foreground">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource PrimaryTextColor}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
|
||||
<VisualState x:Name="Pressed">
|
||||
<Storyboard>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ButtonLayoutGrid" Storyboard.TargetProperty="Background">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="Transparent" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ButtonLayoutGrid" Storyboard.TargetProperty="BorderBrush">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlButtonBorderBrushPressed}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="GlyphElement" Storyboard.TargetProperty="Foreground">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlButtonForegroundPressed}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
|
||||
<VisualState x:Name="Disabled">
|
||||
<Storyboard>
|
||||
<DoubleAnimation Storyboard.TargetName="ButtonLayoutGrid"
|
||||
Storyboard.TargetProperty="Opacity"
|
||||
To="0"
|
||||
Duration="0" />
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
</VisualStateManager.VisualStateGroups>
|
||||
<TextBlock x:Name="GlyphElement"
|
||||
Foreground="{ThemeResource TextControlPlaceholderForeground}"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Center"
|
||||
FontStyle="Normal"
|
||||
FontSize="{ThemeResource AutoSuggestBoxIconFontSize}"
|
||||
Text=""
|
||||
FontFamily="{ThemeResource SymbolThemeFontFamily}"
|
||||
AutomationProperties.AccessibilityView="Raw" />
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
<Style x:Name="QueryButtonStyle" TargetType="Button">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="Button">
|
||||
<ContentPresenter x:Name="ContentPresenter"
|
||||
Foreground="{ThemeResource TextControlPlaceholderForeground}"
|
||||
Background="{ThemeResource TextControlButtonBackground}"
|
||||
BackgroundSizing="{TemplateBinding BackgroundSizing}"
|
||||
BorderBrush="{ThemeResource TextControlButtonBorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
Content="" FontFamily="Segoe MDL2 Assets"
|
||||
ContentTemplate="{TemplateBinding ContentTemplate}"
|
||||
ContentTransitions="{TemplateBinding ContentTransitions}"
|
||||
FontSize="24"
|
||||
Padding="{TemplateBinding Padding}"
|
||||
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
AutomationProperties.AccessibilityView="Raw">
|
||||
|
||||
<VisualStateManager.VisualStateGroups>
|
||||
<VisualStateGroup x:Name="CommonStates">
|
||||
<VisualState x:Name="Normal" />
|
||||
|
||||
<VisualState x:Name="PointerOver">
|
||||
<Storyboard>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Background">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="Transparent" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="BorderBrush">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlButtonBorderBrushPointerOver}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Foreground">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource PrimaryTextColor}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
|
||||
<VisualState x:Name="Pressed">
|
||||
<Storyboard>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Background">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="Transparent" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="BorderBrush">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlButtonBorderBrushPressed}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Foreground">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlButtonForegroundPressed}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
|
||||
<VisualState x:Name="Disabled">
|
||||
<Storyboard>
|
||||
<DoubleAnimation Storyboard.TargetName="ContentPresenter"
|
||||
Storyboard.TargetProperty="Opacity"
|
||||
To="0"
|
||||
Duration="0" />
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
</VisualStateManager.VisualStateGroups>
|
||||
</ContentPresenter>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</Grid.Resources>
|
||||
|
||||
<VisualStateManager.VisualStateGroups>
|
||||
<VisualStateGroup x:Name="CommonStates">
|
||||
|
||||
<VisualState x:Name="Disabled">
|
||||
|
||||
<Storyboard>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="HeaderContentPresenter" Storyboard.TargetProperty="Foreground">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlHeaderForegroundDisabled}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BorderElement" Storyboard.TargetProperty="Background">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlBackgroundDisabled}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BorderElement" Storyboard.TargetProperty="BorderBrush">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlBorderBrushDisabled}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentElement" Storyboard.TargetProperty="Foreground">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlForegroundDisabled}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PlaceholderTextContentPresenter" Storyboard.TargetProperty="Foreground">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlPlaceholderForegroundDisabled}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
<VisualState x:Name="Normal" />
|
||||
|
||||
<VisualState x:Name="PointerOver">
|
||||
|
||||
<Storyboard>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BorderElement" Storyboard.TargetProperty="BorderBrush">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlBorderBrushPointerOver}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<!--<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BorderElement" Storyboard.TargetProperty="Background">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="#FF2e2e2e" />
|
||||
</ObjectAnimationUsingKeyFrames>-->
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PlaceholderTextContentPresenter" Storyboard.TargetProperty="Foreground">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="#FF7e7e7e" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentElement" Storyboard.TargetProperty="Foreground">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource PrimaryTextColor}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
<VisualState x:Name="Focused">
|
||||
|
||||
<Storyboard>
|
||||
<!--<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PlaceholderTextContentPresenter" Storyboard.TargetProperty="Foreground">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="#" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BorderElement" Storyboard.TargetProperty="Background">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="#FF2e2e2e" />
|
||||
</ObjectAnimationUsingKeyFrames>-->
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BorderElement" Storyboard.TargetProperty="BorderBrush">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlBorderBrushFocused}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentElement" Storyboard.TargetProperty="Foreground">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource PrimaryTextColor}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentElement" Storyboard.TargetProperty="RequestedTheme">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="Light" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="QueryButton" Storyboard.TargetProperty="Foreground">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlButtonForeground}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
|
||||
</VisualStateGroup>
|
||||
<VisualStateGroup x:Name="ButtonStates">
|
||||
<VisualState x:Name="ButtonVisible">
|
||||
|
||||
<Storyboard>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="DeleteButton" Storyboard.TargetProperty="Visibility">
|
||||
<DiscreteObjectKeyFrame KeyTime="0">
|
||||
<DiscreteObjectKeyFrame.Value>
|
||||
<Visibility>Visible</Visibility>
|
||||
</DiscreteObjectKeyFrame.Value>
|
||||
</DiscreteObjectKeyFrame>
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
<VisualState x:Name="ButtonCollapsed" />
|
||||
|
||||
</VisualStateGroup>
|
||||
|
||||
</VisualStateManager.VisualStateGroups>
|
||||
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Border x:Name="BorderElement"
|
||||
Grid.Row="1" CornerRadius="4"
|
||||
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
|
||||
Grid.ColumnSpan="3"
|
||||
Grid.RowSpan="1" />
|
||||
<ContentPresenter x:Name="HeaderContentPresenter"
|
||||
x:DeferLoadStrategy="Lazy"
|
||||
Visibility="Collapsed"
|
||||
Grid.Row="0"
|
||||
Foreground="{ThemeResource TextControlHeaderForeground}"
|
||||
Margin="{ThemeResource AutoSuggestBoxTopHeaderMargin}"
|
||||
Grid.ColumnSpan="3"
|
||||
Content="{TemplateBinding Header}"
|
||||
ContentTemplate="{TemplateBinding HeaderTemplate}"
|
||||
FontWeight="Normal"
|
||||
TextWrapping="Wrap" />
|
||||
<ScrollViewer x:Name="ContentElement"
|
||||
Grid.Row="1"
|
||||
HorizontalScrollMode="{TemplateBinding ScrollViewer.HorizontalScrollMode}"
|
||||
HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
|
||||
VerticalScrollMode="{TemplateBinding ScrollViewer.VerticalScrollMode}"
|
||||
VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}"
|
||||
IsHorizontalRailEnabled="{TemplateBinding ScrollViewer.IsHorizontalRailEnabled}"
|
||||
IsVerticalRailEnabled="{TemplateBinding ScrollViewer.IsVerticalRailEnabled}"
|
||||
IsDeferredScrollingEnabled="{TemplateBinding ScrollViewer.IsDeferredScrollingEnabled}"
|
||||
|
||||
Padding="{TemplateBinding Padding}"
|
||||
IsTabStop="False" Margin="12,0,0,0"
|
||||
VerticalAlignment="Center"
|
||||
AutomationProperties.AccessibilityView="Raw"
|
||||
ZoomMode="Disabled" />
|
||||
<ContentControl x:Name="PlaceholderTextContentPresenter"
|
||||
Grid.Row="1" Opacity="0.6" CornerRadius="4"
|
||||
Height="42"
|
||||
Foreground="{ThemeResource TextControlPlaceholderForeground}"
|
||||
Margin="12,0,0,0"
|
||||
Padding="{TemplateBinding Padding}"
|
||||
IsTabStop="False"
|
||||
Grid.ColumnSpan="3"
|
||||
VerticalAlignment="Center"
|
||||
Content="{TemplateBinding PlaceholderText}"
|
||||
IsHitTestVisible="False" />
|
||||
<Button x:Name="DeleteButton"
|
||||
Grid.Row="1"
|
||||
Style="{StaticResource DeleteButtonStyle}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
IsTabStop="False"
|
||||
Grid.Column="1"
|
||||
Visibility="Collapsed" Opacity="0"
|
||||
FontSize="{TemplateBinding FontSize}"
|
||||
MinWidth="34"
|
||||
AutomationProperties.AccessibilityView="Raw"
|
||||
VerticalAlignment="Stretch" />
|
||||
<Button x:Name="QueryButton"
|
||||
Grid.Row="1"
|
||||
Style="{StaticResource QueryButtonStyle}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
IsTabStop="False"
|
||||
Grid.Column="2"
|
||||
FontSize="{TemplateBinding FontSize}"
|
||||
MinWidth="34"
|
||||
Width="{TemplateBinding Height}"
|
||||
VerticalAlignment="Stretch"
|
||||
AutomationProperties.AccessibilityView="Raw"/>
|
||||
<ContentPresenter x:Name="DescriptionPresenter"
|
||||
Grid.Row="2"
|
||||
Grid.ColumnSpan="3"
|
||||
Content="{TemplateBinding Description}"
|
||||
x:Load="False"
|
||||
Foreground="{ThemeResource SystemControlDescriptionTextForegroundBrush}"
|
||||
AutomationProperties.AccessibilityView="Raw" />
|
||||
|
||||
</Grid>
|
||||
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
<ThemeShadow x:Name="ShellBarShadow"/>
|
||||
</UserControl.Resources>
|
||||
<Grid>
|
||||
<StackPanel Background="LightCoral">
|
||||
<TextBlock>This is a simple custom UWP control</TextBlock>
|
||||
<Rectangle Fill="Blue" Height="100" Width="100"/>
|
||||
<TextBlock Text="{x:Bind XamlIslandMessage}" FontSize="50"></TextBlock>
|
||||
</StackPanel>
|
||||
<Grid x:Name="ShadowReceiverGrid"/>
|
||||
<Grid x:Name="PowerBar" CornerRadius="4" Height="72" Background="{StaticResource BackdropAcrylicBrush}" Translation="0,0,16" Shadow="{StaticResource ShellBarShadow}" Margin="12" VerticalAlignment="Top" HorizontalAlignment="Center" MinWidth="240">
|
||||
|
||||
|
||||
<AutoSuggestBox x:Name="SearchBox" PlaceholderText="Launch an app" FontSize="24" Style="{StaticResource CustomStyledAutoSuggestBox}" TextChanged="SearchBox_TextChanged" MinWidth="720" >
|
||||
<AutoSuggestBox.QueryIcon>
|
||||
<SymbolIcon Symbol="Find"/>
|
||||
</AutoSuggestBox.QueryIcon>
|
||||
<AutoSuggestBox.ItemTemplate>
|
||||
<DataTemplate x:DataType="local:SearchApp">
|
||||
<Grid Height="72" Width="690" Background="Transparent" RowSpacing="0">
|
||||
<Interactivity:Interaction.Behaviors>
|
||||
<Core:EventTriggerBehavior EventName="PointerEntered">
|
||||
<Core:CallMethodAction TargetObject="{Binding ElementName=ShowActionButtons}" MethodName="StartAnimation"/>
|
||||
|
||||
</Core:EventTriggerBehavior>
|
||||
<Core:EventTriggerBehavior EventName="PointerExited">
|
||||
<Core:CallMethodAction TargetObject="{Binding ElementName=HideActionsButtons}" MethodName="StartAnimation"/>
|
||||
</Core:EventTriggerBehavior>
|
||||
</Interactivity:Interaction.Behaviors>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="64" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions >
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Image x:Name="AppIcon" Source="{x:Bind Icon}" Height="36" Margin="8,0,0,0" Grid.RowSpan="2" HorizontalAlignment="Left" />
|
||||
<TextBlock x:Name="Title" Grid.Column="1" Text="{x:Bind Title}" FontWeight="SemiBold" FontSize="20" VerticalAlignment="Bottom"/>
|
||||
<TextBlock x:Name="Path" Grid.Column="1" Text="C:\Program Files\WindowsApps\Microsoft\Folder " Grid.Row="1" Opacity="0.6" VerticalAlignment="Top"/>
|
||||
<StackPanel Orientation="Horizontal" Opacity="0" HorizontalAlignment="Right" Grid.RowSpan="2" Grid.Column="1">
|
||||
<Interactivity:Interaction.Behaviors>
|
||||
<ToolkitBehaviors:Fade x:Name="ShowActionButtons" Duration="250" Delay="0" AutomaticallyStart="False" Value="1" />
|
||||
<ToolkitBehaviors:Fade x:Name="HideActionsButtons" Duration="250" Delay="0" AutomaticallyStart="False" Value="0" />
|
||||
</Interactivity:Interaction.Behaviors>
|
||||
<Button Background="Transparent" Height="42" Width="42" Grid.Column="1" BorderThickness="1" Style="{ThemeResource ButtonRevealStyle}">
|
||||
<ToolTipService.ToolTip>
|
||||
<TextBlock Text="Run as administrator"/>
|
||||
</ToolTipService.ToolTip>
|
||||
<Button.Content>
|
||||
<FontIcon FontFamily="Segoe MDL2 Assets" FontSize="16" Glyph=""/>
|
||||
</Button.Content>
|
||||
</Button>
|
||||
<Button Background="Transparent" Height="42" Width="42" Grid.Column="1" BorderThickness="1" Style="{ThemeResource ButtonRevealStyle}">
|
||||
<ToolTipService.ToolTip>
|
||||
<TextBlock Text="Open file location"/>
|
||||
</ToolTipService.ToolTip>
|
||||
<Button.Content>
|
||||
<FontIcon FontFamily="Segoe MDL2 Assets" FontSize="16" Glyph=""/>
|
||||
</Button.Content>
|
||||
</Button>
|
||||
<Button Background="Transparent" Height="42" Width="42" Grid.Column="1" BorderThickness="1" Style="{ThemeResource ButtonRevealStyle}">
|
||||
<ToolTipService.ToolTip>
|
||||
<TextBlock Text="Open in console"/>
|
||||
</ToolTipService.ToolTip>
|
||||
<Button.Content>
|
||||
<FontIcon FontFamily="Segoe MDL2 Assets" FontSize="16" Glyph=""/>
|
||||
</Button.Content>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
|
||||
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</AutoSuggestBox.ItemTemplate>
|
||||
</AutoSuggestBox>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
</UserControl>
|
@ -15,17 +15,59 @@ using Windows.UI.Xaml.Navigation;
|
||||
|
||||
// The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236
|
||||
|
||||
namespace PowerLauncher.UI
|
||||
namespace PowerToysUX.Controls
|
||||
{
|
||||
public sealed partial class LauncherControl : UserControl
|
||||
public sealed partial class PowerLaunch : UserControl
|
||||
{
|
||||
public string XamlIslandMessage { get; set; }
|
||||
|
||||
public LauncherControl()
|
||||
List<SearchApp> SearchResults;
|
||||
public PowerLaunch()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
ShellBarShadow.Receivers.Add(ShadowReceiverGrid);
|
||||
SearchResults = new List<SearchApp>
|
||||
{
|
||||
new SearchApp() { Title = "Calendar", Icon = "ms-appx:///Assets/Images/Calendar.png" },
|
||||
new SearchApp() { Title = "Camera", Icon = "ms-appx:///Assets/Images/Camera.png" },
|
||||
new SearchApp() { Title = "Excel", Icon = "ms-appx:///Assets/Images/Excel.png" },
|
||||
new SearchApp() { Title = "Feedback", Icon = "ms-appx:///Assets/Images/Feedback.png" },
|
||||
new SearchApp() { Title = "File Explorer", Icon = "ms-appx:///Assets/Images/FileExplorer.png" },
|
||||
new SearchApp() { Title = "Groove", Icon = "ms-appx:///Assets/Images/Groove.png" },
|
||||
new SearchApp() { Title = "Mail", Icon = "ms-appx:///Assets/Images/Mail.png" },
|
||||
new SearchApp() { Title = "Mobile", Icon = "ms-appx:///Assets/Images/Mobile.png" },
|
||||
new SearchApp() { Title = "Movies", Icon = "ms-appx:///Assets/Images/Movies.png" },
|
||||
new SearchApp() { Title = "OneDrive", Icon = "ms-appx:///Assets/Images/OneDrive.png" },
|
||||
new SearchApp() { Title = "OneNote", Icon = "ms-appx:///Assets/Images/OneNote.png" },
|
||||
new SearchApp() { Title = "Outlook", Icon = "ms-appx:///Assets/Images/Outlook.png" },
|
||||
new SearchApp() { Title = "Photos", Icon = "ms-appx:///Assets/Images/Photos.png" },
|
||||
new SearchApp() { Title = "PowerPoint", Icon = "ms-appx:///Assets/Images/PowerPoint.png" },
|
||||
new SearchApp() { Title = "PowerToys", Icon = "ms-appx:///Assets/Images/PowerToysIcon.png" },
|
||||
new SearchApp() { Title = "Screen Sketch", Icon = "ms-appx:///Assets/Images/ScreenSketch.png" },
|
||||
new SearchApp() { Title = "SharePoint", Icon = "ms-appx:///Assets/Images/SharePoint.png" },
|
||||
new SearchApp() { Title = "Skype", Icon = "ms-appx:///Assets/Images/Skype.png" },
|
||||
new SearchApp() { Title = "Solitaire", Icon = "ms-appx:///Assets/Images/Solitaire.png" },
|
||||
new SearchApp() { Title = "Teams", Icon = "ms-appx:///Assets/Images/Teams.png" },
|
||||
new SearchApp() { Title = "Weather", Icon = "ms-appx:///Assets/Images/Weather.png" },
|
||||
new SearchApp() { Title = "Whiteboard", Icon = "ms-appx:///Assets/Images/Whiteboard.png" },
|
||||
new SearchApp() { Title = "Word", Icon = "ms-appx:///Assets/Images/Word.png" },
|
||||
new SearchApp() { Title = "Yammer", Icon = "ms-appx:///Assets/Images/Yammer.png" }
|
||||
};
|
||||
}
|
||||
|
||||
private void SearchBox_TextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args)
|
||||
{
|
||||
if (args.Reason == AutoSuggestionBoxTextChangeReason.UserInput)
|
||||
{
|
||||
var Suggestion = SearchResults.Where(p => p.Title.StartsWith(sender.Text, StringComparison.OrdinalIgnoreCase)).ToArray();
|
||||
sender.ItemsSource = Suggestion;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class SearchApp
|
||||
{
|
||||
public string Title { get; set; }
|
||||
public string Icon { get; set; }
|
||||
public string Path { get; set; }
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user