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">
|
2024-08-20 01:53:59 -07:00
|
|
|
<ListBox x:Name="BranchesPresenter"
|
|
|
|
Classes="repo_left_content_list"
|
|
|
|
ItemsSource="{Binding #ThisControl.Rows}"
|
|
|
|
SelectionMode="Multiple"
|
|
|
|
SelectionChanged="OnNodesSelectionChanged"
|
|
|
|
ContextRequested="OnTreeContextRequested">
|
|
|
|
<ListBox.ItemsPanel>
|
|
|
|
<ItemsPanelTemplate>
|
|
|
|
<VirtualizingStackPanel Orientation="Vertical"/>
|
|
|
|
</ItemsPanelTemplate>
|
|
|
|
</ListBox.ItemsPanel>
|
2024-07-06 02:17:41 -07:00
|
|
|
|
2024-08-20 01:53:59 -07:00
|
|
|
<ListBox.Styles>
|
|
|
|
<Style Selector="ListBoxItem" x:DataType="vm:BranchTreeNode">
|
|
|
|
<Setter Property="CornerRadius" Value="{Binding CornerRadius}"/>
|
2024-07-06 02:17:41 -07:00
|
|
|
</Style>
|
2024-11-13 05:45:28 -08:00
|
|
|
|
|
|
|
<Style Selector="ListBoxItem:pointerover v|FilterModeSwitchButton">
|
|
|
|
<Setter Property="IsNoneVisible" Value="True"/>
|
|
|
|
</Style>
|
2024-08-20 01:53:59 -07:00
|
|
|
</ListBox.Styles>
|
2024-07-06 02:17:41 -07:00
|
|
|
|
2024-08-20 01:53:59 -07:00
|
|
|
<ListBox.ItemTemplate>
|
|
|
|
<DataTemplate DataType="vm:BranchTreeNode">
|
|
|
|
<Grid Height="24"
|
|
|
|
Margin="{Binding Depth, Converter={x:Static c:IntConverters.ToTreeMargin}}"
|
|
|
|
ColumnDefinitions="16,*"
|
|
|
|
ToolTip.Tip="{Binding Tooltip}">
|
2024-07-06 08:50:54 -07:00
|
|
|
|
2024-10-16 23:57:05 -07:00
|
|
|
<!-- Tree Expander -->
|
|
|
|
<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-10-16 23:57:05 -07:00
|
|
|
<!-- Content Area (allows double-click) -->
|
|
|
|
<Grid Grid.Column="1"
|
|
|
|
Background="Transparent"
|
|
|
|
ColumnDefinitions="18,*,Auto,Auto"
|
|
|
|
DoubleTapped="OnDoubleTappedBranchNode">
|
2024-07-06 08:50:54 -07:00
|
|
|
|
2024-10-16 23:57:05 -07:00
|
|
|
<!-- Icon -->
|
|
|
|
<v:BranchTreeNodeIcon Grid.Column="0"
|
|
|
|
Node="{Binding}"
|
|
|
|
IsExpanded="{Binding IsExpanded}"/>
|
2024-07-06 02:17:41 -07:00
|
|
|
|
2024-10-16 23:57:05 -07:00
|
|
|
<!-- Name -->
|
|
|
|
<TextBlock Grid.Column="1"
|
|
|
|
Text="{Binding Name}"
|
|
|
|
Classes="primary"
|
|
|
|
FontWeight="{Binding NameFontWeight}"
|
|
|
|
TextTrimming="CharacterEllipsis"/>
|
2024-07-06 08:50:54 -07:00
|
|
|
|
2024-10-16 23:57:05 -07:00
|
|
|
<!-- Tracking status -->
|
|
|
|
<v:BranchTreeNodeTrackStatusPresenter Grid.Column="2"
|
|
|
|
VerticalAlignment="Center"
|
|
|
|
FontFamily="{DynamicResource Fonts.Monospace}"
|
|
|
|
FontSize="10"
|
|
|
|
Foreground="{DynamicResource Brush.BadgeFG}"
|
|
|
|
Background="{DynamicResource Brush.Badge}"/>
|
2024-07-06 02:17:41 -07:00
|
|
|
|
2024-11-13 05:45:28 -08:00
|
|
|
<!-- Filter Mode Switcher -->
|
|
|
|
<v:FilterModeSwitchButton Grid.Column="3"
|
|
|
|
Margin="0,0,8,0"
|
|
|
|
Mode="{Binding FilterMode}"/>
|
2024-08-20 01:53:59 -07:00
|
|
|
</Grid>
|
|
|
|
</Grid>
|
|
|
|
</DataTemplate>
|
|
|
|
</ListBox.ItemTemplate>
|
|
|
|
</ListBox>
|
2024-07-06 02:17:41 -07:00
|
|
|
</UserControl>
|
|
|
|
|