2024-07-06 02:17:41 -07:00
|
|
|
<UserControl xmlns="https://github.com/avaloniaui"
|
|
|
|
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:c="using:SourceGit.Converters"
|
|
|
|
xmlns:v="using:SourceGit.Views"
|
|
|
|
xmlns:vm="using:SourceGit.ViewModels"
|
|
|
|
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
|
|
|
x:Class="SourceGit.Views.BranchTree"
|
|
|
|
x:Name="ThisControl">
|
|
|
|
<DataGrid x:Name="BranchesPresenter"
|
|
|
|
ItemsSource="{Binding #ThisControl.Rows}"
|
|
|
|
Background="Transparent"
|
|
|
|
RowHeight="24"
|
|
|
|
CanUserReorderColumns="False"
|
|
|
|
CanUserResizeColumns="False"
|
|
|
|
CanUserSortColumns="False"
|
|
|
|
HorizontalScrollBarVisibility="Disabled"
|
|
|
|
VerticalScrollBarVisibility="Auto"
|
|
|
|
HeadersVisibility="None"
|
|
|
|
SelectionChanged="OnNodesSelectionChanged"
|
|
|
|
ContextRequested="OnTreeContextRequested">
|
|
|
|
<DataGrid.Styles>
|
|
|
|
<Style Selector="DataGridRow" x:DataType="vm:BranchTreeNode">
|
|
|
|
<Setter Property="CornerRadius" Value="{Binding CornerRadius}" />
|
2024-08-08 06:21:30 -07:00
|
|
|
<Setter Property="Height" Value="24"/>
|
2024-07-06 02:17:41 -07:00
|
|
|
</Style>
|
|
|
|
|
|
|
|
<Style Selector="DataGridRow /template/ Border#RowBorder">
|
|
|
|
<Setter Property="ClipToBounds" Value="True" />
|
|
|
|
</Style>
|
|
|
|
|
|
|
|
<Style Selector="Grid.repository_leftpanel DataGridRow:pointerover /template/ Rectangle#BackgroundRectangle">
|
|
|
|
<Setter Property="Fill" Value="{DynamicResource Brush.AccentHovered}" />
|
|
|
|
<Setter Property="Opacity" Value=".5"/>
|
|
|
|
</Style>
|
|
|
|
<Style Selector="Grid.repository_leftpanel DataGridRow:selected /template/ Rectangle#BackgroundRectangle">
|
|
|
|
<Setter Property="Fill" Value="{DynamicResource Brush.AccentHovered}" />
|
|
|
|
<Setter Property="Opacity" Value="1"/>
|
|
|
|
</Style>
|
|
|
|
<Style Selector="Grid.repository_leftpanel:focus-within DataGridRow:selected /template/ Rectangle#BackgroundRectangle">
|
|
|
|
<Setter Property="Fill" Value="{DynamicResource Brush.Accent}" />
|
|
|
|
<Setter Property="Opacity" Value=".65"/>
|
|
|
|
</Style>
|
|
|
|
<Style Selector="Grid.repository_leftpanel:focus-within DataGridRow:selected:pointerover /template/ Rectangle#BackgroundRectangle">
|
|
|
|
<Setter Property="Fill" Value="{DynamicResource Brush.Accent}" />
|
|
|
|
<Setter Property="Opacity" Value=".8"/>
|
|
|
|
</Style>
|
|
|
|
</DataGrid.Styles>
|
2024-07-06 08:50:54 -07:00
|
|
|
|
2024-07-06 02:17:41 -07:00
|
|
|
<DataGrid.Columns>
|
|
|
|
<DataGridTemplateColumn Width="*">
|
|
|
|
<DataGridTemplateColumn.CellTemplate>
|
|
|
|
<DataTemplate x:DataType="vm:BranchTreeNode">
|
|
|
|
<Grid Height="24"
|
2024-07-06 08:50:54 -07:00
|
|
|
Margin="{Binding Depth, Converter={x:Static c:IntConverters.ToTreeMargin}}"
|
2024-07-11 20:01:02 -07:00
|
|
|
ColumnDefinitions="16,*"
|
2024-07-06 02:17:41 -07:00
|
|
|
ToolTip.Tip="{Binding Tooltip}">
|
2024-07-06 08:50:54 -07:00
|
|
|
|
2024-07-06 02:17:41 -07:00
|
|
|
<!-- Tree Expander -->
|
2024-07-11 20:01:02 -07:00
|
|
|
<v:BranchTreeNodeToggleButton Grid.Column="0"
|
|
|
|
Classes="tree_expander"
|
|
|
|
Focusable="False"
|
|
|
|
HorizontalAlignment="Center"
|
|
|
|
IsChecked="{Binding IsExpanded, Mode=OneWay}"
|
|
|
|
IsVisible="{Binding !IsBranch}"/>
|
2024-07-06 08:50:54 -07:00
|
|
|
|
2024-07-11 20:01:02 -07:00
|
|
|
<!-- Content Area (allows double-click) -->
|
|
|
|
<Grid Grid.Column="1"
|
|
|
|
Background="Transparent"
|
2024-07-14 01:06:40 -07:00
|
|
|
ColumnDefinitions="18,*,Auto,Auto"
|
2024-07-11 20:01:02 -07:00
|
|
|
DoubleTapped="OnDoubleTappedBranchNode">
|
|
|
|
|
|
|
|
<!-- Icon -->
|
|
|
|
<v:BranchTreeNodeIcon Grid.Column="0"
|
|
|
|
Node="{Binding}"
|
|
|
|
IsExpanded="{Binding IsExpanded}"/>
|
2024-07-06 02:17:41 -07:00
|
|
|
|
2024-07-11 20:01:02 -07:00
|
|
|
<!-- Name -->
|
|
|
|
<TextBlock Grid.Column="1"
|
|
|
|
Text="{Binding Name}"
|
2024-07-29 05:48:04 -07:00
|
|
|
Classes="primary"
|
2024-07-11 20:01:02 -07:00
|
|
|
FontWeight="{Binding NameFontWeight}"/>
|
2024-07-06 08:50:54 -07:00
|
|
|
|
2024-07-11 20:01:02 -07:00
|
|
|
<!-- Tracking status -->
|
2024-08-13 03:24:28 -07:00
|
|
|
<v:BranchTreeNodeTrackStatusPresenter Grid.Column="2"
|
|
|
|
Margin="8,0"
|
|
|
|
VerticalAlignment="Center"
|
|
|
|
FontFamily="{Binding Source={x:Static vm:Preference.Instance}, Path=MonospaceFont}"
|
|
|
|
FontSize="10"
|
|
|
|
Foreground="{DynamicResource Brush.BadgeFG}"
|
|
|
|
Background="{DynamicResource Brush.Badge}"/>
|
2024-07-06 02:17:41 -07:00
|
|
|
|
2024-07-11 20:01:02 -07:00
|
|
|
<!-- Filter Toggle Button -->
|
|
|
|
<ToggleButton Grid.Column="3"
|
|
|
|
Classes="filter"
|
|
|
|
Margin="0,0,8,0"
|
|
|
|
Background="Transparent"
|
|
|
|
IsCheckedChanged="OnToggleFilter"
|
|
|
|
IsVisible="{Binding IsBranch}"
|
|
|
|
IsChecked="{Binding IsFiltered}"
|
|
|
|
ToolTip.Tip="{DynamicResource Text.Filter}"/>
|
|
|
|
</Grid>
|
2024-07-06 02:17:41 -07:00
|
|
|
</Grid>
|
|
|
|
</DataTemplate>
|
|
|
|
</DataGridTemplateColumn.CellTemplate>
|
|
|
|
</DataGridTemplateColumn>
|
|
|
|
</DataGrid.Columns>
|
|
|
|
</DataGrid>
|
|
|
|
</UserControl>
|
|
|
|
|