sourcegit/src/Views/FolderBrowser.xaml
2021-04-29 20:05:55 +08:00

98 lines
4.9 KiB
XML

<Window x:Class="SourceGit.Views.FolderBrowser"
x:Name="me"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:controls="clr-namespace:SourceGit.Views.Controls"
mc:Ignorable="d"
Title="{StaticResource Text.FolderDialog}"
WindowStartupLocation="CenterOwner"
ResizeMode="NoResize"
Height="400" Width="400">
<WindowChrome.WindowChrome>
<WindowChrome UseAeroCaptionButtons="False" CornerRadius="0" CaptionHeight="28" ResizeBorderThickness="1"/>
</WindowChrome.WindowChrome>
<controls:WindowBorder>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="32"/>
<RowDefinition Height="32"/>
<RowDefinition Height="*"/>
<RowDefinition Height="48"/>
</Grid.RowDefinitions>
<!-- Title Bar -->
<Grid Grid.Row="0" Background="{StaticResource Brush.TitleBar}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<!-- ICON -->
<Path Grid.Column="0" Width="16" Height="16" Margin="6,0" Data="{StaticResource Icon.Folder.Open}"/>
<!-- Title -->
<TextBlock Grid.Column="1" Text="{Binding ElementName=me, Path=Description}"/>
<!-- Close -->
<controls:IconButton
Grid.Column="3"
Click="Quit"
Width="32" Height="32"
Padding="9"
WindowChrome.IsHitTestVisibleInChrome="True"
Icon="{StaticResource Icon.Close}"
HoverBackground="Red"/>
</Grid>
<!-- Selected -->
<StackPanel Grid.Row="1" Orientation="Horizontal" Margin="8,4">
<TextBlock Text="{StaticResource Text.FolderDialog.Selected}"/>
<TextBlock x:Name="txtSelected" Text="NONE" Foreground="{StaticResource Brush.FG2}" Margin="8,0,0,0"/>
</StackPanel>
<!-- File System Tree -->
<Border
Grid.Row="2"
Margin="8,0"
Background="{StaticResource Brush.Contents}"
BorderBrush="{StaticResource Brush.Border0}"
BorderThickness="1">
<controls:Tree x:Name="tree" FontFamily="Consolas" ItemsSource="{Binding ElementName=me, Path=Nodes}" SelectionChanged="OnTreeSelectionChanged">
<controls:Tree.ItemContainerStyle>
<Style TargetType="{x:Type controls:TreeItem}" BasedOn="{StaticResource Style.TreeItem}">
<EventSetter Event="Expanded" Handler="OnTreeNodeExpanded"/>
</Style>
</controls:Tree.ItemContainerStyle>
<controls:Tree.ItemTemplate>
<HierarchicalDataTemplate ItemsSource="{Binding Children}">
<StackPanel Orientation="Horizontal" Height="24">
<Path x:Name="Icon" Width="14" Height="14" Fill="Goldenrod" Data="{StaticResource Icon.Folder.Fill}"/>
<TextBlock Text="{Binding Name}" Margin="6,0,0,0"/>
</StackPanel>
<HierarchicalDataTemplate.Triggers>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type controls:TreeItem}}, Path=IsExpanded}" Value="True">
<Setter TargetName="Icon" Property="Data" Value="{StaticResource Icon.Folder.Open}"/>
</DataTrigger>
</HierarchicalDataTemplate.Triggers>
</HierarchicalDataTemplate>
</controls:Tree.ItemTemplate>
</controls:Tree>
</Border>
<!-- Options -->
<Border Grid.Row="3">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<Button x:Name="btnSure" IsEnabled="False" Width="100" Height="32" Content="{StaticResource Text.Sure}" Background="{StaticResource Brush.Accent1}" BorderBrush="{StaticResource Brush.FG1}"/>
<Button Click="Quit" Width="100" Height="32" Margin="8,0,0,0" Content="{StaticResource Text.Cancel}"/>
</StackPanel>
</Border>
</Grid>
</controls:WindowBorder>
</Window>