mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-06-01 17:24:59 +00:00
feature<FolderDialog>: add FolderDialog to remove dependency on System.Windows.Forms
This commit is contained in:
parent
6bf06c87f1
commit
e42290eef1
14 changed files with 336 additions and 121 deletions
105
src/UI/FolderDailog.xaml
Normal file
105
src/UI/FolderDailog.xaml
Normal file
|
@ -0,0 +1,105 @@
|
|||
<Window x:Class="SourceGit.UI.FolderDailog"
|
||||
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"
|
||||
mc:Ignorable="d"
|
||||
Title="FolderDailog"
|
||||
Height="400" Width="400"
|
||||
ResizeMode="NoResize">
|
||||
|
||||
<!-- Enable WindowChrome Feature -->
|
||||
<WindowChrome.WindowChrome>
|
||||
<WindowChrome UseAeroCaptionButtons="False" CornerRadius="0" CaptionHeight="32"/>
|
||||
</WindowChrome.WindowChrome>
|
||||
|
||||
<!-- Window Layout -->
|
||||
<Border Background="{StaticResource Brush.BG1}">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="32"/>
|
||||
<RowDefinition Height="32"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="48"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- Titlebar -->
|
||||
<Grid Grid.Row="0" Background="{StaticResource Brush.BG4}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<!-- LOGO -->
|
||||
<Path Width="20" Height="20" Margin="6,-1,2,0" Style="{StaticResource Style.Icon}" Data="{StaticResource Icon.Info}"/>
|
||||
|
||||
<!-- Title -->
|
||||
<Label Grid.Column="1" x:Name="txtTitle" FontWeight="Light"/>
|
||||
|
||||
<!-- Close Button -->
|
||||
<Button Click="OnQuit" Width="32" Grid.Column="3" WindowChrome.IsHitTestVisibleInChrome="True">
|
||||
<Button.Style>
|
||||
<Style TargetType="{x:Type Button}" BasedOn="{StaticResource Style.Button.HighlightHover}">
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="Red"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Button.Style>
|
||||
|
||||
<Path Width="10" Style="{StaticResource Style.Icon}" Data="{StaticResource Icon.Close}"/>
|
||||
</Button>
|
||||
</Grid>
|
||||
|
||||
<!-- Current -->
|
||||
<StackPanel Grid.Row="1" Orientation="Horizontal" Margin="0,4,0,0">
|
||||
<Label Content="Selected :" />
|
||||
<Label x:Name="txtSelected" Content="NONE" Foreground="{StaticResource Brush.FG2}"/>
|
||||
</StackPanel>
|
||||
|
||||
<!-- File system tree -->
|
||||
<Border Grid.Row="2" Margin="4" Background="{StaticResource Brush.BG1}" BorderBrush="{StaticResource Brush.FG2}" BorderThickness="1">
|
||||
<TreeView x:Name="treePath" FontFamily="Consolas" PreviewMouseWheel="OnTreeMouseWheel" SelectedItemChanged="OnTreeSelectedChanged">
|
||||
<TreeView.ItemContainerStyle>
|
||||
<Style TargetType="{x:Type TreeViewItem}" BasedOn="{StaticResource Style.TreeView.ItemContainerStyle}">
|
||||
<Setter Property="IsExpanded" Value="{Binding IsOpened, Mode=TwoWay}"/>
|
||||
<EventSetter Event="Expanded" Handler="OnTreeNodeExpanded"/>
|
||||
</Style>
|
||||
</TreeView.ItemContainerStyle>
|
||||
|
||||
<TreeView.ItemTemplate>
|
||||
<HierarchicalDataTemplate ItemsSource="{Binding Children}">
|
||||
<StackPanel Orientation="Horizontal" Height="24">
|
||||
<Path x:Name="icon" Width="14" Style="{StaticResource Style.Icon}" Fill="Goldenrod" Data="{StaticResource Icon.Folder.Fill}"/>
|
||||
<TextBlock Text="{Binding Name}" Foreground="{StaticResource Brush.FG}" VerticalAlignment="Center" Margin="6,0,0,0" FontSize="11"/>
|
||||
</StackPanel>
|
||||
|
||||
<HierarchicalDataTemplate.Triggers>
|
||||
<DataTrigger Binding="{Binding IsOpened}" Value="True">
|
||||
<Setter TargetName="icon" Property="Data" Value="{StaticResource Icon.Folder.Open}"/>
|
||||
</DataTrigger>
|
||||
</HierarchicalDataTemplate.Triggers>
|
||||
</HierarchicalDataTemplate>
|
||||
</TreeView.ItemTemplate>
|
||||
</TreeView>
|
||||
</Border>
|
||||
|
||||
<!-- Operations -->
|
||||
<Grid Grid.Row="3">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="8"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Button Grid.Column="1" x:Name="btnSure" Width="100" Height="32" Content="SURE" Click="OnSure" Style="{StaticResource Style.Button.AccentBordered}"/>
|
||||
<Button Grid.Column="3" Width="100" Height="32" Content="CANCEL" Click="OnQuit" Style="{StaticResource Style.Button.Bordered}"/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Window>
|
Loading…
Add table
Add a link
Reference in a new issue