PowerToys/src/modules/launcher/PowerLauncher/MainWindow.xaml
2021-06-06 15:32:21 +02:00

101 lines
5.7 KiB
XML

<Window x:Class="PowerLauncher.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:vm="clr-namespace:PowerLauncher.ViewModel"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:PowerLauncher"
mc:Ignorable="d"
Title="PowerToys Run"
Topmost="True"
SizeToContent="Height"
ResizeMode="NoResize"
WindowStyle="None"
WindowStartupLocation="Manual"
AllowDrop="True"
ShowInTaskbar="False"
Icon="Images/app.dark.png"
AllowsTransparency="True"
Loaded="OnLoaded"
Closing="OnClosing"
Background="Transparent"
LocationChanged="OnLocationChanged"
Deactivated="OnDeactivated"
IsVisibleChanged="OnVisibilityChanged"
Visibility="{Binding MainWindowVisibility, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
d:DataContext="{d:DesignInstance vm:MainViewModel}">
<Window.Resources>
<CubicEase x:Key="CubicEaseOut" EasingMode="EaseOut"/>
<!-- Some of the durations are different to give a 'parallax' feel (like start menu has as well) -->
<!--<Storyboard x:Key="IntroStoryboard">
<DoubleAnimation From="20" To="0" Duration="0:0:0.2" Storyboard.TargetName="SearchBoxBorder" Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.Y)" EasingFunction="{StaticResource CubicEaseOut}"/>
<DoubleAnimation From="20" To="0" Duration="0:0:0.250" Storyboard.TargetName="SearchBox" Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.Y)" EasingFunction="{StaticResource CubicEaseOut}"/>
<DoubleAnimation From="0.5" To="1" Duration="0:0:0.150" Storyboard.TargetName="SearchBoxBorder" Storyboard.TargetProperty="(UIElement.Opacity)" EasingFunction="{StaticResource CubicEaseOut}"/>
<DoubleAnimation From="-10" To="0" Duration="0:0:0.2" Storyboard.TargetName="ListBoxBorder" Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.Y)" EasingFunction="{StaticResource CubicEaseOut}"/>
<DoubleAnimation From="0.5" To="1" Duration="0:0:0.1" Storyboard.TargetName="ListBoxBorder" Storyboard.TargetProperty="(UIElement.Opacity)" EasingFunction="{StaticResource CubicEaseOut}"/>
</Storyboard>-->
<!-- Duration is a bit shorter, since it's an outro animation and you want it to be gone asap -->
<!--<Storyboard x:Key="OutroStoryboard" Completed="OutroStoryboard_Completed">
<DoubleAnimation From="0" To="20" Duration="0:0:0.18" Storyboard.TargetName="SearchBoxBorder" Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.Y)" EasingFunction="{StaticResource CubicEaseOut}"/>
<DoubleAnimation From="1" To="0.0" Duration="0:0:0.18" Storyboard.TargetName="SearchBoxBorder" Storyboard.TargetProperty="(UIElement.Opacity)" EasingFunction="{StaticResource CubicEaseOut}"/>
<DoubleAnimation From="0" To="-10" Duration="0:0:0.18" Storyboard.TargetName="ListBoxBorder" Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.Y)" EasingFunction="{StaticResource CubicEaseOut}"/>
<DoubleAnimation From="1" To="0.0" Duration="0:0:0.18" Storyboard.TargetName="ListBoxBorder" Storyboard.TargetProperty="(UIElement.Opacity)" EasingFunction="{StaticResource CubicEaseOut}"/>
</Storyboard>-->
</Window.Resources>
<Grid Width="720"
MouseDown="OnMouseDown">
<Grid
x:Name="SearchBoxBorder"
Grid.Row="0"
Margin="24,24,24,24">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Rectangle Fill="{DynamicResource SystemChromeLow}"
RadiusX="4"
RadiusY="4"
Grid.RowSpan="2"
Stroke="{DynamicResource DialogBorderBrush}"
StrokeThickness="1">
<Rectangle.Effect>
<DropShadowEffect BlurRadius="32" Opacity="0.28" ShadowDepth="1" />
</Rectangle.Effect>
</Rectangle>
<local:LauncherControl
x:Name="SearchBox">
<!--<local:LauncherControl.RenderTransform>
<TranslateTransform />
</local:LauncherControl.RenderTransform>-->
</local:LauncherControl>
<!--<Border.RenderTransform>
<TranslateTransform />
</Border.RenderTransform>-->
<local:ResultList x:Name="ListBox"
Grid.Row="1"
Margin="1"
Visibility="{Binding Results.Visibility}"
PreviewMouseDown="ListBox_PreviewMouseDown">
<!--<local:ResultList.RenderTransform>
<TranslateTransform />
</local:ResultList.RenderTransform>-->
</local:ResultList>
</Grid>
</Grid>
<Window.InputBindings>
<KeyBinding Key="Escape"
Command="{Binding EscCommand}" />
<KeyBinding Key="Enter"
Command="{Binding OpenResultWithKeyboardCommand}" />
<KeyBinding Modifiers="Alt"
Key="F4"
Command="{Binding IgnoreCommand}" />
</Window.InputBindings>
</Window>