finder-wpf / FastSeekWpf /MainWindow.xaml
anshdadhich's picture
Upload FastSeekWpf/MainWindow.xaml
40eeff9 verified
<Window x:Class="FastSeekWpf.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:FastSeekWpf"
Title="FastSeek"
Name="FastSeekWnd"
Width="720"
MinHeight="80"
MaxHeight="560"
WindowStyle="None"
AllowsTransparency="True"
Background="Transparent"
ShowInTaskbar="False"
Topmost="True"
ResizeMode="NoResize"
SizeToContent="Height"
WindowStartupLocation="Manual"
Loaded="Window_Loaded"
Deactivated="Window_Deactivated"
KeyDown="Window_KeyDown"
SnapsToDevicePixels="False"
UseLayoutRounding="True"
RenderOptions.BitmapScalingMode="HighQuality"
Opacity="0">
<Window.Resources>
<!-- Brushes -->
<SolidColorBrush x:Key="BgSolid" Color="#0E1018"/>
<SolidColorBrush x:Key="AccentBrush" Color="#5B8DEF"/>
<SolidColorBrush x:Key="TextBrush" Color="#E8ECF4"/>
<SolidColorBrush x:Key="TextDimBrush" Color="#6B7280"/>
<SolidColorBrush x:Key="BorderBrush" Color="#1E2230"/>
<SolidColorBrush x:Key="HoverBrush" Color="#1A2035"/>
<SolidColorBrush x:Key="SelectedBrush" Color="#162238"/>
<SolidColorBrush x:Key="SearchBg" Color="#161B2A"/>
<SolidColorBrush x:Key="SearchBorder" Color="#252B3D"/>
<local:KindToBadgeConverter x:Key="KindToBadge"/>
<local:PathShortenerConverter x:Key="PathShortener"/>
<BooleanToVisibilityConverter x:Key="BoolToVis"/>
<!-- Window appear animation -->
<Storyboard x:Key="AppearAnim">
<DoubleAnimation Storyboard.TargetProperty="Opacity"
From="0" To="1" Duration="0:0:0.12">
<DoubleAnimation.EasingFunction>
<QuadraticEase EasingMode="EaseOut"/>
</DoubleAnimation.EasingFunction>
</DoubleAnimation>
<DoubleAnimation Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleX)"
From="0.97" To="1" Duration="0:0:0.15">
<DoubleAnimation.EasingFunction>
<QuadraticEase EasingMode="EaseOut"/>
</DoubleAnimation.EasingFunction>
</DoubleAnimation>
<DoubleAnimation Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleY)"
From="0.97" To="1" Duration="0:0:0.15">
<DoubleAnimation.EasingFunction>
<QuadraticEase EasingMode="EaseOut"/>
</DoubleAnimation.EasingFunction>
</DoubleAnimation>
</Storyboard>
<Storyboard x:Key="FadeAnim">
<DoubleAnimation Storyboard.TargetProperty="Opacity"
To="0" Duration="0:0:0.08"/>
</Storyboard>
<!-- Search box style -->
<Style x:Key="SearchBoxStyle" TargetType="TextBox">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Foreground" Value="{StaticResource TextBrush}"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="FontSize" Value="19"/>
<Setter Property="FontFamily" Value="Segoe UI Variable Text, Segoe UI, sans-serif"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Padding" Value="44,0,16,0"/>
<Setter Property="CaretBrush" Value="{StaticResource AccentBrush}"/>
<Setter Property="SelectionBrush" Value="#3A5A8A"/>
<Setter Property="SelectionOpacity" Value="0.6"/>
</Style>
<!-- Result item container style -->
<Style x:Key="ResultContainerStyle" TargetType="ListBoxItem">
<Setter Property="Padding" Value="0"/>
<Setter Property="Margin" Value="8,1,8,1"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListBoxItem">
<Border x:Name="Bd"
Background="{TemplateBinding Background}"
CornerRadius="8"
SnapsToDevicePixels="False">
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter TargetName="Bd" Property="Background" Value="{StaticResource SelectedBrush}"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Bd" Property="Background" Value="{StaticResource HoverBrush}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- Result item data template -->
<DataTemplate x:Key="ResultItemTemplate" DataType="local:ResultItem">
<Border Height="52" Background="Transparent" Cursor="Hand"
MouseLeftButtonDown="ResultItem_Click">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="48"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="12"/>
</Grid.ColumnDefinitions>
<!-- Icon background circle -->
<Border Grid.Column="0" Width="32" Height="32" CornerRadius="8"
Background="{Binding Kind, Converter={StaticResource KindToBadge}}"
HorizontalAlignment="Center" VerticalAlignment="Center"
Opacity="0.15">
</Border>
<TextBlock Grid.Column="0" Text="{Binding IconGlyph}" FontFamily="Segoe MDL2 Assets" FontSize="16"
Foreground="{Binding Kind, Converter={StaticResource KindToBadge}}"
HorizontalAlignment="Center" VerticalAlignment="Center"/>
<StackPanel Grid.Column="1" VerticalAlignment="Center" Margin="4,0,0,0">
<TextBlock Text="{Binding DisplayName}" FontSize="14" FontWeight="SemiBold"
Foreground="{StaticResource TextBrush}" TextTrimming="CharacterEllipsis"/>
<TextBlock Text="{Binding FullPath, Converter={StaticResource PathShortener}}"
FontSize="11" Foreground="{StaticResource TextDimBrush}"
TextTrimming="CharacterEllipsis" Margin="0,2,0,0"/>
</StackPanel>
<Border Grid.Column="2" CornerRadius="4" Padding="6,2" VerticalAlignment="Center" Margin="8,0,0,0"
Background="{Binding Kind, Converter={StaticResource KindToBadge}}" Opacity="0.85">
<TextBlock Text="{Binding BadgeLabel}" FontSize="9" FontWeight="Bold"
Foreground="White"/>
</Border>
</Grid>
</Border>
</DataTemplate>
</Window.Resources>
<Window.RenderTransform>
<ScaleTransform ScaleX="1" ScaleY="1" CenterX="360" CenterY="0"/>
</Window.RenderTransform>
<!-- Outer glow / shadow border -->
<Border Background="Transparent" CornerRadius="14" Margin="12"
BorderThickness="1" BorderBrush="{StaticResource BorderBrush}"
SnapsToDevicePixels="False">
<Border.Effect>
<DropShadowEffect BlurRadius="32" ShadowDepth="0" Direction="0" Opacity="0.35" Color="Black"
RenderingBias="Quality"/>
</Border.Effect>
<!-- Main content with rounded background -->
<Border Background="{StaticResource BgSolid}" CornerRadius="12"
BorderThickness="1" BorderBrush="#1A1E2E"
MouseLeftButtonDown="Window_MouseLeftButtonDown">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<!-- Search Bar -->
<Border Grid.Row="0" Margin="16,16,16,8" CornerRadius="10"
Background="{StaticResource SearchBg}"
BorderThickness="1" BorderBrush="{StaticResource SearchBorder}">
<Grid Height="46">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="&#xE721;" FontFamily="Segoe MDL2 Assets" FontSize="16"
Foreground="{StaticResource TextDimBrush}" Margin="16,0,0,0"
VerticalAlignment="Center"/>
<TextBox Grid.Column="1" x:Name="SearchBox" Style="{StaticResource SearchBoxStyle}"
TextChanged="SearchBox_TextChanged" Loaded="SearchBox_Loaded"
VerticalAlignment="Center"/>
</Grid>
</Border>
<!-- Separator -->
<Rectangle Grid.Row="1" Height="1" Fill="White" Opacity="0.04" x:Name="SepLine"
Margin="16,0,16,0" Visibility="Collapsed"/>
<!-- Results -->
<Border Grid.Row="2" Margin="8,4,8,4" CornerRadius="8" Background="Transparent"
Visibility="{Binding Results.Count, RelativeSource={RelativeSource AncestorType=Window}, Converter={StaticResource BoolToVis}}">
<ScrollViewer x:Name="ResultsScroll" VerticalScrollBarVisibility="Auto"
MaxHeight="380" Style="{x:Null}">
<ListBox x:Name="ResultsList"
ItemsSource="{Binding Results, RelativeSource={RelativeSource AncestorType=Window}}"
ItemTemplate="{StaticResource ResultItemTemplate}"
ItemContainerStyle="{StaticResource ResultContainerStyle}"
Background="Transparent"
BorderThickness="0"
Focusable="False"
SelectionChanged="ResultsList_SelectionChanged"
VirtualizingStackPanel.IsVirtualizing="True"
VirtualizingStackPanel.VirtualizationMode="Recycling"
ScrollViewer.CanContentScroll="True">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel IsItemsHost="True"/>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
</ListBox>
</ScrollViewer>
</Border>
<!-- Empty state hint -->
<TextBlock Grid.Row="2" x:Name="EmptyHint"
Text="Start typing to search your files..."
Foreground="{StaticResource TextDimBrush}"
FontSize="13"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Margin="0,20,0,20"
Visibility="Collapsed"/>
<!-- Status Bar -->
<Border Grid.Row="3" x:Name="StatusBar" Height="32"
Background="Transparent" Visibility="Collapsed"
Margin="16,0,16,8">
<Grid>
<TextBlock x:Name="StatusText" FontSize="11" Foreground="{StaticResource TextDimBrush}"
VerticalAlignment="Center"/>
<TextBlock x:Name="HotkeyHint" FontSize="11" Foreground="{StaticResource TextDimBrush}"
VerticalAlignment="Center" HorizontalAlignment="Right"
Text="Ctrl+Shift+Space to toggle"/>
</Grid>
</Border>
</Grid>
</Border>
</Border>
</Window>