mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-24 20:57:19 -08:00
ux: use ListBox with VirtualizingStackPanel instead of DataGrid since height of DataGridRow is not equal with the RowHeight value
This commit is contained in:
parent
d4a9343eaf
commit
9844043c7f
6 changed files with 180 additions and 254 deletions
|
@ -706,6 +706,58 @@
|
||||||
<Setter Property="Opacity" Value="1"/>
|
<Setter Property="Opacity" Value="1"/>
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
|
<Style Selector="ListBox.repo_left_content_list">
|
||||||
|
<Setter Property="Background" Value="Transparent"/>
|
||||||
|
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled"/>
|
||||||
|
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
|
||||||
|
<Setter Property="ItemsPanel">
|
||||||
|
<ItemsPanelTemplate>
|
||||||
|
<VirtualizingStackPanel Orientation="Vertical"/>
|
||||||
|
</ItemsPanelTemplate>
|
||||||
|
</Setter>
|
||||||
|
|
||||||
|
<Style Selector="^ ListBoxItem">
|
||||||
|
<Setter Property="Height" Value="24"/>
|
||||||
|
<Setter Property="Margin" Value="0"/>
|
||||||
|
<Setter Property="Padding" Value="0"/>
|
||||||
|
<Setter Property="CornerRadius" Value="4"/>
|
||||||
|
|
||||||
|
<Setter Property="Template">
|
||||||
|
<ControlTemplate>
|
||||||
|
<Grid>
|
||||||
|
<Border Name="PART_Background"
|
||||||
|
Background="Transparent"
|
||||||
|
CornerRadius="{TemplateBinding CornerRadius}"
|
||||||
|
Opacity="0"/>
|
||||||
|
|
||||||
|
<ContentPresenter ContentTemplate="{TemplateBinding ContentTemplate}"
|
||||||
|
Content="{TemplateBinding Content}"
|
||||||
|
Padding="{TemplateBinding Padding}"
|
||||||
|
VerticalContentAlignment="Center"
|
||||||
|
HorizontalContentAlignment="Stretch" />
|
||||||
|
</Grid>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style Selector="Grid.repository_leftpanel ListBox.repo_left_content_list ListBoxItem:pointerover /template/ Border#PART_Background">
|
||||||
|
<Setter Property="Background" Value="{DynamicResource Brush.AccentHovered}" />
|
||||||
|
<Setter Property="Opacity" Value=".5"/>
|
||||||
|
</Style>
|
||||||
|
<Style Selector="Grid.repository_leftpanel ListBox.repo_left_content_list ListBoxItem:selected /template/ Border#PART_Background">
|
||||||
|
<Setter Property="Background" Value="{DynamicResource Brush.AccentHovered}" />
|
||||||
|
<Setter Property="Opacity" Value="1"/>
|
||||||
|
</Style>
|
||||||
|
<Style Selector="Grid.repository_leftpanel:focus-within ListBox.repo_left_content_list ListBoxItem:selected /template/ Border#PART_Background">
|
||||||
|
<Setter Property="Background" Value="{DynamicResource Brush.Accent}" />
|
||||||
|
<Setter Property="Opacity" Value=".65"/>
|
||||||
|
</Style>
|
||||||
|
<Style Selector="Grid.repository_leftpanel:focus-within ListBox.repo_left_content_list ListBoxItem:selected:pointerover /template/ Border#PART_Background">
|
||||||
|
<Setter Property="Background" Value="{DynamicResource Brush.Accent}" />
|
||||||
|
<Setter Property="Opacity" Value=".8"/>
|
||||||
|
</Style>
|
||||||
|
|
||||||
<Style Selector="ContextMenu">
|
<Style Selector="ContextMenu">
|
||||||
<Setter Property="HorizontalOffset" Value="-4"/>
|
<Setter Property="HorizontalOffset" Value="-4"/>
|
||||||
<Setter Property="VerticalOffset" Value="-4"/>
|
<Setter Property="VerticalOffset" Value="-4"/>
|
||||||
|
|
|
@ -8,104 +8,78 @@
|
||||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||||
x:Class="SourceGit.Views.BranchTree"
|
x:Class="SourceGit.Views.BranchTree"
|
||||||
x:Name="ThisControl">
|
x:Name="ThisControl">
|
||||||
<DataGrid x:Name="BranchesPresenter"
|
<ListBox x:Name="BranchesPresenter"
|
||||||
ItemsSource="{Binding #ThisControl.Rows}"
|
Classes="repo_left_content_list"
|
||||||
Background="Transparent"
|
ItemsSource="{Binding #ThisControl.Rows}"
|
||||||
RowHeight="24"
|
SelectionMode="Multiple"
|
||||||
CanUserReorderColumns="False"
|
SelectionChanged="OnNodesSelectionChanged"
|
||||||
CanUserResizeColumns="False"
|
ContextRequested="OnTreeContextRequested">
|
||||||
CanUserSortColumns="False"
|
<ListBox.ItemsPanel>
|
||||||
HorizontalScrollBarVisibility="Disabled"
|
<ItemsPanelTemplate>
|
||||||
VerticalScrollBarVisibility="Auto"
|
<VirtualizingStackPanel Orientation="Vertical"/>
|
||||||
HeadersVisibility="None"
|
</ItemsPanelTemplate>
|
||||||
SelectionChanged="OnNodesSelectionChanged"
|
</ListBox.ItemsPanel>
|
||||||
ContextRequested="OnTreeContextRequested">
|
|
||||||
<DataGrid.Styles>
|
<ListBox.Styles>
|
||||||
<Style Selector="DataGridRow" x:DataType="vm:BranchTreeNode">
|
<Style Selector="ListBoxItem" x:DataType="vm:BranchTreeNode">
|
||||||
<Setter Property="CornerRadius" Value="{Binding CornerRadius}" />
|
<Setter Property="CornerRadius" Value="{Binding CornerRadius}"/>
|
||||||
<Setter Property="Height" Value="24"/>
|
|
||||||
</Style>
|
</Style>
|
||||||
|
</ListBox.Styles>
|
||||||
|
|
||||||
<Style Selector="DataGridRow /template/ Border#RowBorder">
|
<ListBox.ItemTemplate>
|
||||||
<Setter Property="ClipToBounds" Value="True" />
|
<DataTemplate DataType="vm:BranchTreeNode">
|
||||||
</Style>
|
<Grid Height="24"
|
||||||
|
Margin="{Binding Depth, Converter={x:Static c:IntConverters.ToTreeMargin}}"
|
||||||
|
ColumnDefinitions="16,*"
|
||||||
|
ToolTip.Tip="{Binding Tooltip}">
|
||||||
|
|
||||||
<Style Selector="Grid.repository_leftpanel DataGridRow:pointerover /template/ Rectangle#BackgroundRectangle">
|
<!-- Tree Expander -->
|
||||||
<Setter Property="Fill" Value="{DynamicResource Brush.AccentHovered}" />
|
<v:BranchTreeNodeToggleButton Grid.Column="0"
|
||||||
<Setter Property="Opacity" Value=".5"/>
|
Classes="tree_expander"
|
||||||
</Style>
|
Focusable="False"
|
||||||
<Style Selector="Grid.repository_leftpanel DataGridRow:selected /template/ Rectangle#BackgroundRectangle">
|
HorizontalAlignment="Center"
|
||||||
<Setter Property="Fill" Value="{DynamicResource Brush.AccentHovered}" />
|
IsChecked="{Binding IsExpanded, Mode=OneWay}"
|
||||||
<Setter Property="Opacity" Value="1"/>
|
IsVisible="{Binding !IsBranch}"/>
|
||||||
</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>
|
|
||||||
|
|
||||||
<DataGrid.Columns>
|
<!-- Content Area (allows double-click) -->
|
||||||
<DataGridTemplateColumn Width="*">
|
<Grid Grid.Column="1"
|
||||||
<DataGridTemplateColumn.CellTemplate>
|
Background="Transparent"
|
||||||
<DataTemplate x:DataType="vm:BranchTreeNode">
|
ColumnDefinitions="18,*,Auto,Auto"
|
||||||
<Grid Height="24"
|
DoubleTapped="OnDoubleTappedBranchNode">
|
||||||
Margin="{Binding Depth, Converter={x:Static c:IntConverters.ToTreeMargin}}"
|
|
||||||
ColumnDefinitions="16,*"
|
|
||||||
ToolTip.Tip="{Binding Tooltip}">
|
|
||||||
|
|
||||||
<!-- Tree Expander -->
|
<!-- Icon -->
|
||||||
<v:BranchTreeNodeToggleButton Grid.Column="0"
|
<v:BranchTreeNodeIcon Grid.Column="0"
|
||||||
Classes="tree_expander"
|
Node="{Binding}"
|
||||||
Focusable="False"
|
IsExpanded="{Binding IsExpanded}"/>
|
||||||
HorizontalAlignment="Center"
|
|
||||||
IsChecked="{Binding IsExpanded, Mode=OneWay}"
|
|
||||||
IsVisible="{Binding !IsBranch}"/>
|
|
||||||
|
|
||||||
<!-- Content Area (allows double-click) -->
|
<!-- Name -->
|
||||||
<Grid Grid.Column="1"
|
<TextBlock Grid.Column="1"
|
||||||
Background="Transparent"
|
Text="{Binding Name}"
|
||||||
ColumnDefinitions="18,*,Auto,Auto"
|
Classes="primary"
|
||||||
DoubleTapped="OnDoubleTappedBranchNode">
|
FontWeight="{Binding NameFontWeight}"/>
|
||||||
|
|
||||||
<!-- Icon -->
|
<!-- Tracking status -->
|
||||||
<v:BranchTreeNodeIcon Grid.Column="0"
|
<v:BranchTreeNodeTrackStatusPresenter Grid.Column="2"
|
||||||
Node="{Binding}"
|
Margin="8,0"
|
||||||
IsExpanded="{Binding IsExpanded}"/>
|
VerticalAlignment="Center"
|
||||||
|
FontFamily="{DynamicResource Fonts.Monospace}"
|
||||||
|
FontSize="10"
|
||||||
|
Foreground="{DynamicResource Brush.BadgeFG}"
|
||||||
|
Background="{DynamicResource Brush.Badge}"/>
|
||||||
|
|
||||||
<!-- Name -->
|
<!-- Filter Toggle Button -->
|
||||||
<TextBlock Grid.Column="1"
|
<ToggleButton Grid.Column="3"
|
||||||
Text="{Binding Name}"
|
Classes="filter"
|
||||||
Classes="primary"
|
Margin="0,0,8,0"
|
||||||
FontWeight="{Binding NameFontWeight}"/>
|
Background="Transparent"
|
||||||
|
IsCheckedChanged="OnToggleFilter"
|
||||||
<!-- Tracking status -->
|
IsVisible="{Binding IsBranch}"
|
||||||
<v:BranchTreeNodeTrackStatusPresenter Grid.Column="2"
|
IsChecked="{Binding IsFiltered}"
|
||||||
Margin="8,0"
|
ToolTip.Tip="{DynamicResource Text.Filter}"/>
|
||||||
VerticalAlignment="Center"
|
</Grid>
|
||||||
FontFamily="{DynamicResource Fonts.Monospace}"
|
</Grid>
|
||||||
FontSize="10"
|
</DataTemplate>
|
||||||
Foreground="{DynamicResource Brush.BadgeFG}"
|
</ListBox.ItemTemplate>
|
||||||
Background="{DynamicResource Brush.Badge}"/>
|
</ListBox>
|
||||||
|
|
||||||
<!-- 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>
|
|
||||||
</Grid>
|
|
||||||
</DataTemplate>
|
|
||||||
</DataGridTemplateColumn.CellTemplate>
|
|
||||||
</DataGridTemplateColumn>
|
|
||||||
</DataGrid.Columns>
|
|
||||||
</DataGrid>
|
|
||||||
</UserControl>
|
</UserControl>
|
||||||
|
|
||||||
|
|
|
@ -240,70 +240,31 @@
|
||||||
</Button>
|
</Button>
|
||||||
</Grid>
|
</Grid>
|
||||||
</ToggleButton>
|
</ToggleButton>
|
||||||
<DataGrid Grid.Row="7"
|
<ListBox Grid.Row="7"
|
||||||
x:Name="SubmoduleList"
|
x:Name="SubmoduleList"
|
||||||
Height="0"
|
Height="0"
|
||||||
Margin="8,0,4,0"
|
Margin="8,0,4,0"
|
||||||
Background="Transparent"
|
Classes="repo_left_content_list"
|
||||||
ItemsSource="{Binding Submodules}"
|
ItemsSource="{Binding Submodules}"
|
||||||
SelectionMode="Single"
|
SelectionMode="Single"
|
||||||
CanUserReorderColumns="False"
|
ContextRequested="OnSubmoduleContextRequested"
|
||||||
CanUserResizeColumns="False"
|
DoubleTapped="OnDoubleTappedSubmodule"
|
||||||
CanUserSortColumns="False"
|
PropertyChanged="OnLeftSidebarDataGridPropertyChanged"
|
||||||
IsReadOnly="True"
|
IsVisible="{Binding IsSubmoduleGroupExpanded, Mode=OneWay}">
|
||||||
HeadersVisibility="None"
|
<ListBox.ItemTemplate>
|
||||||
Focusable="False"
|
<DataTemplate DataType="m:Submodule">
|
||||||
RowHeight="24"
|
<Grid ColumnDefinitions="Auto,*,8">
|
||||||
HorizontalScrollBarVisibility="Disabled"
|
<Path Grid.Column="0" Width="10" Height="10" Margin="8,0" Data="{StaticResource Icons.Submodule}"/>
|
||||||
VerticalScrollBarVisibility="Auto"
|
<TextBlock Grid.Column="1" Text="{Binding Path}" ClipToBounds="True" Classes="primary" TextTrimming="CharacterEllipsis"/>
|
||||||
ContextRequested="OnSubmoduleContextRequested"
|
<Path Grid.Column="2"
|
||||||
DoubleTapped="OnDoubleTappedSubmodule"
|
Width="8" Height="8"
|
||||||
PropertyChanged="OnLeftSidebarDataGridPropertyChanged"
|
Fill="Goldenrod"
|
||||||
IsVisible="{Binding IsSubmoduleGroupExpanded, Mode=OneWay}">
|
Data="{StaticResource Icons.Modified}"
|
||||||
<DataGrid.Styles>
|
IsVisible="{Binding IsDirty}"/>
|
||||||
<Style Selector="DataGridRow">
|
</Grid>
|
||||||
<Setter Property="CornerRadius" Value="4" />
|
</DataTemplate>
|
||||||
<Setter Property="Height" Value="24"/>
|
</ListBox.ItemTemplate>
|
||||||
</Style>
|
</ListBox>
|
||||||
|
|
||||||
<Style Selector="DataGridRow /template/ Border#RowBorder">
|
|
||||||
<Setter Property="ClipToBounds" Value="True" />
|
|
||||||
</Style>
|
|
||||||
|
|
||||||
<Style Selector="DataGridRow:pointerover /template/ Rectangle#BackgroundRectangle">
|
|
||||||
<Setter Property="Fill" Value="{DynamicResource Brush.AccentHovered}" />
|
|
||||||
</Style>
|
|
||||||
|
|
||||||
<Style Selector="DataGridRow:selected /template/ Rectangle#BackgroundRectangle">
|
|
||||||
<Setter Property="Fill" Value="{DynamicResource Brush.Accent}" />
|
|
||||||
</Style>
|
|
||||||
</DataGrid.Styles>
|
|
||||||
|
|
||||||
<DataGrid.Columns>
|
|
||||||
<DataGridTemplateColumn Header="ICON">
|
|
||||||
<DataGridTemplateColumn.CellTemplate>
|
|
||||||
<DataTemplate>
|
|
||||||
<Path Width="10" Height="10" Margin="8,0" Data="{StaticResource Icons.Submodule}"/>
|
|
||||||
</DataTemplate>
|
|
||||||
</DataGridTemplateColumn.CellTemplate>
|
|
||||||
</DataGridTemplateColumn>
|
|
||||||
|
|
||||||
<DataGridTemplateColumn Width="*" Header="NAME">
|
|
||||||
<DataGridTemplateColumn.CellTemplate>
|
|
||||||
<DataTemplate>
|
|
||||||
<Grid Background="Transparent" Margin="0,0,4,0" ColumnDefinitions="*,8">
|
|
||||||
<TextBlock Grid.Column="0" Text="{Binding Path}" ClipToBounds="True" Classes="primary" TextTrimming="CharacterEllipsis"/>
|
|
||||||
<Path Grid.Column="1"
|
|
||||||
Width="8" Height="8"
|
|
||||||
Fill="Goldenrod"
|
|
||||||
Data="{StaticResource Icons.Modified}"
|
|
||||||
IsVisible="{Binding IsDirty}"/>
|
|
||||||
</Grid>
|
|
||||||
</DataTemplate>
|
|
||||||
</DataGridTemplateColumn.CellTemplate>
|
|
||||||
</DataGridTemplateColumn>
|
|
||||||
</DataGrid.Columns>
|
|
||||||
</DataGrid>
|
|
||||||
|
|
||||||
<!-- Worktrees -->
|
<!-- Worktrees -->
|
||||||
<ToggleButton Grid.Row="8" Classes="group_expander" IsChecked="{Binding IsWorktreeGroupExpanded, Mode=TwoWay}">
|
<ToggleButton Grid.Row="8" Classes="group_expander" IsChecked="{Binding IsWorktreeGroupExpanded, Mode=TwoWay}">
|
||||||
|
@ -329,74 +290,30 @@
|
||||||
</Button>
|
</Button>
|
||||||
</Grid>
|
</Grid>
|
||||||
</ToggleButton>
|
</ToggleButton>
|
||||||
<DataGrid Grid.Row="9"
|
<ListBox Grid.Row="9"
|
||||||
x:Name="WorktreeList"
|
x:Name="WorktreeList"
|
||||||
Height="0"
|
Height="0"
|
||||||
Margin="8,0,4,0"
|
Margin="8,0,4,0"
|
||||||
Background="Transparent"
|
Classes="repo_left_content_list"
|
||||||
ItemsSource="{Binding Worktrees}"
|
ItemsSource="{Binding Worktrees}"
|
||||||
SelectionMode="Single"
|
SelectionMode="Single"
|
||||||
CanUserReorderColumns="False"
|
ContextRequested="OnWorktreeContextRequested"
|
||||||
CanUserResizeColumns="False"
|
DoubleTapped="OnDoubleTappedWorktree"
|
||||||
CanUserSortColumns="False"
|
PropertyChanged="OnLeftSidebarDataGridPropertyChanged"
|
||||||
IsReadOnly="True"
|
IsVisible="{Binding IsWorktreeGroupExpanded, Mode=OneWay}">
|
||||||
HeadersVisibility="None"
|
<ListBox.ItemTemplate>
|
||||||
Focusable="False"
|
<DataTemplate DataType="m:Worktree">
|
||||||
RowHeight="24"
|
<Grid ColumnDefinitions="Auto,*,22">
|
||||||
HorizontalScrollBarVisibility="Disabled"
|
<Path Grid.Column="0" Width="10" Height="10" Margin="8,0,0,0" Data="{StaticResource Icons.Worktree}"/>
|
||||||
VerticalScrollBarVisibility="Auto"
|
<TextBlock Grid.Column="1" Classes="primary" Margin="8,0,0,0" TextTrimming="CharacterEllipsis">
|
||||||
ContextRequested="OnWorktreeContextRequested"
|
<Run Text="{Binding FullPath}"/>
|
||||||
DoubleTapped="OnDoubleTappedWorktree"
|
<Run Text="{Binding Name}" Foreground="{DynamicResource Brush.FG2}"/>
|
||||||
PropertyChanged="OnLeftSidebarDataGridPropertyChanged"
|
</TextBlock>
|
||||||
IsVisible="{Binding IsWorktreeGroupExpanded, Mode=OneWay}">
|
<Path Grid.Column="2" Width="10" Height="10" Margin="4,0,0,0" Data="{StaticResource Icons.Lock}" Fill="{DynamicResource Brush.FG2}" IsVisible="{Binding IsLocked}"/>
|
||||||
<DataGrid.Styles>
|
</Grid>
|
||||||
<Style Selector="DataGridRow">
|
</DataTemplate>
|
||||||
<Setter Property="CornerRadius" Value="4"/>
|
</ListBox.ItemTemplate>
|
||||||
<Setter Property="Height" Value="24"/>
|
</ListBox>
|
||||||
</Style>
|
|
||||||
|
|
||||||
<Style Selector="DataGridRow /template/ Border#RowBorder">
|
|
||||||
<Setter Property="ClipToBounds" Value="True" />
|
|
||||||
</Style>
|
|
||||||
|
|
||||||
<Style Selector="DataGridRow:pointerover /template/ Rectangle#BackgroundRectangle">
|
|
||||||
<Setter Property="Fill" Value="{DynamicResource Brush.AccentHovered}" />
|
|
||||||
</Style>
|
|
||||||
|
|
||||||
<Style Selector="DataGridRow:selected /template/ Rectangle#BackgroundRectangle">
|
|
||||||
<Setter Property="Fill" Value="{DynamicResource Brush.Accent}" />
|
|
||||||
</Style>
|
|
||||||
</DataGrid.Styles>
|
|
||||||
|
|
||||||
<DataGrid.Columns>
|
|
||||||
<DataGridTemplateColumn Header="ICON">
|
|
||||||
<DataGridTemplateColumn.CellTemplate>
|
|
||||||
<DataTemplate>
|
|
||||||
<Path Width="10" Height="10" Margin="8,0,0,0" Data="{StaticResource Icons.Worktree}"/>
|
|
||||||
</DataTemplate>
|
|
||||||
</DataGridTemplateColumn.CellTemplate>
|
|
||||||
</DataGridTemplateColumn>
|
|
||||||
|
|
||||||
<DataGridTemplateColumn Width="*" Header="FullPath">
|
|
||||||
<DataGridTemplateColumn.CellTemplate>
|
|
||||||
<DataTemplate>
|
|
||||||
<TextBlock Classes="primary" Margin="8,0,0,0" TextTrimming="CharacterEllipsis">
|
|
||||||
<Run Text="{Binding FullPath}"/>
|
|
||||||
<Run Text="{Binding Name}" Foreground="{DynamicResource Brush.FG2}"/>
|
|
||||||
</TextBlock>
|
|
||||||
</DataTemplate>
|
|
||||||
</DataGridTemplateColumn.CellTemplate>
|
|
||||||
</DataGridTemplateColumn>
|
|
||||||
|
|
||||||
<DataGridTemplateColumn Header="FullPath">
|
|
||||||
<DataGridTemplateColumn.CellTemplate>
|
|
||||||
<DataTemplate>
|
|
||||||
<Path Width="10" Height="10" Margin="4,0,8,0" Data="{StaticResource Icons.Lock}" Fill="{DynamicResource Brush.FG2}" IsVisible="{Binding IsLocked}"/>
|
|
||||||
</DataTemplate>
|
|
||||||
</DataGridTemplateColumn.CellTemplate>
|
|
||||||
</DataGridTemplateColumn>
|
|
||||||
</DataGrid.Columns>
|
|
||||||
</DataGrid>
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
|
|
|
@ -200,7 +200,7 @@ namespace SourceGit.Views
|
||||||
|
|
||||||
private void OnSubmoduleContextRequested(object sender, ContextRequestedEventArgs e)
|
private void OnSubmoduleContextRequested(object sender, ContextRequestedEventArgs e)
|
||||||
{
|
{
|
||||||
if (sender is DataGrid { SelectedItem: Models.Submodule submodule } grid && DataContext is ViewModels.Repository repo)
|
if (sender is ListBox { SelectedItem: Models.Submodule submodule } grid && DataContext is ViewModels.Repository repo)
|
||||||
{
|
{
|
||||||
var menu = repo.CreateContextMenuForSubmodule(submodule.Path);
|
var menu = repo.CreateContextMenuForSubmodule(submodule.Path);
|
||||||
grid.OpenContextMenu(menu);
|
grid.OpenContextMenu(menu);
|
||||||
|
@ -211,7 +211,7 @@ namespace SourceGit.Views
|
||||||
|
|
||||||
private void OnDoubleTappedSubmodule(object sender, TappedEventArgs e)
|
private void OnDoubleTappedSubmodule(object sender, TappedEventArgs e)
|
||||||
{
|
{
|
||||||
if (sender is DataGrid { SelectedItem: Models.Submodule submodule } && DataContext is ViewModels.Repository repo)
|
if (sender is ListBox { SelectedItem: Models.Submodule submodule } && DataContext is ViewModels.Repository repo)
|
||||||
{
|
{
|
||||||
repo.OpenSubmodule(submodule.Path);
|
repo.OpenSubmodule(submodule.Path);
|
||||||
}
|
}
|
||||||
|
@ -221,7 +221,7 @@ namespace SourceGit.Views
|
||||||
|
|
||||||
private void OnWorktreeContextRequested(object sender, ContextRequestedEventArgs e)
|
private void OnWorktreeContextRequested(object sender, ContextRequestedEventArgs e)
|
||||||
{
|
{
|
||||||
if (sender is DataGrid { SelectedItem: Models.Worktree worktree } grid && DataContext is ViewModels.Repository repo)
|
if (sender is ListBox { SelectedItem: Models.Worktree worktree } grid && DataContext is ViewModels.Repository repo)
|
||||||
{
|
{
|
||||||
var menu = repo.CreateContextMenuForWorktree(worktree);
|
var menu = repo.CreateContextMenuForWorktree(worktree);
|
||||||
grid.OpenContextMenu(menu);
|
grid.OpenContextMenu(menu);
|
||||||
|
@ -232,7 +232,7 @@ namespace SourceGit.Views
|
||||||
|
|
||||||
private void OnDoubleTappedWorktree(object sender, TappedEventArgs e)
|
private void OnDoubleTappedWorktree(object sender, TappedEventArgs e)
|
||||||
{
|
{
|
||||||
if (sender is DataGrid { SelectedItem: Models.Worktree worktree } && DataContext is ViewModels.Repository repo)
|
if (sender is ListBox { SelectedItem: Models.Worktree worktree } && DataContext is ViewModels.Repository repo)
|
||||||
{
|
{
|
||||||
repo.OpenWorktree(worktree);
|
repo.OpenWorktree(worktree);
|
||||||
}
|
}
|
||||||
|
@ -242,7 +242,7 @@ namespace SourceGit.Views
|
||||||
|
|
||||||
private void OnLeftSidebarDataGridPropertyChanged(object _, AvaloniaPropertyChangedEventArgs e)
|
private void OnLeftSidebarDataGridPropertyChanged(object _, AvaloniaPropertyChangedEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.Property == DataGrid.ItemsSourceProperty || e.Property == DataGrid.IsVisibleProperty)
|
if (e.Property == ListBox.ItemsSourceProperty || e.Property == ListBox.IsVisibleProperty)
|
||||||
UpdateLeftSidebarLayout();
|
UpdateLeftSidebarLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -266,8 +266,8 @@ namespace SourceGit.Views
|
||||||
var remoteBranchRows = vm.IsRemoteGroupExpanded ? RemoteBranchTree.Rows.Count : 0;
|
var remoteBranchRows = vm.IsRemoteGroupExpanded ? RemoteBranchTree.Rows.Count : 0;
|
||||||
var desiredBranches = (localBranchRows + remoteBranchRows) * 24.0;
|
var desiredBranches = (localBranchRows + remoteBranchRows) * 24.0;
|
||||||
var desiredTag = vm.IsTagGroupExpanded ? 24.0 * TagsList.Rows : 0;
|
var desiredTag = vm.IsTagGroupExpanded ? 24.0 * TagsList.Rows : 0;
|
||||||
var desiredSubmodule = vm.IsSubmoduleGroupExpanded ? SubmoduleList.RowHeight * vm.Submodules.Count : 0;
|
var desiredSubmodule = vm.IsSubmoduleGroupExpanded ? 24.0 * vm.Submodules.Count : 0;
|
||||||
var desiredWorktree = vm.IsWorktreeGroupExpanded ? WorktreeList.RowHeight * vm.Worktrees.Count : 0;
|
var desiredWorktree = vm.IsWorktreeGroupExpanded ? 24.0 * vm.Worktrees.Count : 0;
|
||||||
var desiredOthers = desiredTag + desiredSubmodule + desiredWorktree;
|
var desiredOthers = desiredTag + desiredSubmodule + desiredWorktree;
|
||||||
var hasOverflow = (desiredBranches + desiredOthers > leftHeight);
|
var hasOverflow = (desiredBranches + desiredOthers > leftHeight);
|
||||||
|
|
||||||
|
|
|
@ -8,29 +8,10 @@
|
||||||
xmlns:c="using:SourceGit.Converters"
|
xmlns:c="using:SourceGit.Converters"
|
||||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||||
x:Class="SourceGit.Views.TagsView">
|
x:Class="SourceGit.Views.TagsView">
|
||||||
<UserControl.Styles>
|
|
||||||
<Style Selector="ListBox">
|
|
||||||
<Setter Property="Background" Value="Transparent"/>
|
|
||||||
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled"/>
|
|
||||||
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
|
|
||||||
<Setter Property="ItemsPanel">
|
|
||||||
<ItemsPanelTemplate>
|
|
||||||
<VirtualizingStackPanel Orientation="Vertical"/>
|
|
||||||
</ItemsPanelTemplate>
|
|
||||||
</Setter>
|
|
||||||
</Style>
|
|
||||||
|
|
||||||
<Style Selector="ListBoxItem">
|
|
||||||
<Setter Property="Height" Value="24"/>
|
|
||||||
<Setter Property="Margin" Value="0"/>
|
|
||||||
<Setter Property="Padding" Value="0"/>
|
|
||||||
<Setter Property="CornerRadius" Value="4"/>
|
|
||||||
</Style>
|
|
||||||
</UserControl.Styles>
|
|
||||||
|
|
||||||
<UserControl.DataTemplates>
|
<UserControl.DataTemplates>
|
||||||
<DataTemplate DataType="vm:TagCollectionAsTree">
|
<DataTemplate DataType="vm:TagCollectionAsTree">
|
||||||
<ListBox ItemsSource="{Binding Rows}"
|
<ListBox Classes="repo_left_content_list"
|
||||||
|
ItemsSource="{Binding Rows}"
|
||||||
SelectionMode="Single"
|
SelectionMode="Single"
|
||||||
SelectionChanged="OnRowSelectionChanged">
|
SelectionChanged="OnRowSelectionChanged">
|
||||||
<ListBox.ItemTemplate>
|
<ListBox.ItemTemplate>
|
||||||
|
@ -70,7 +51,8 @@
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
|
|
||||||
<DataTemplate DataType="vm:TagCollectionAsList">
|
<DataTemplate DataType="vm:TagCollectionAsList">
|
||||||
<ListBox ItemsSource="{Binding Tags}"
|
<ListBox Classes="repo_left_content_list"
|
||||||
|
ItemsSource="{Binding Tags}"
|
||||||
SelectionMode="Single"
|
SelectionMode="Single"
|
||||||
SelectionChanged="OnRowSelectionChanged">
|
SelectionChanged="OnRowSelectionChanged">
|
||||||
<ListBox.ItemTemplate>
|
<ListBox.ItemTemplate>
|
||||||
|
|
|
@ -282,6 +282,7 @@ namespace SourceGit.Views
|
||||||
var tags = Tags;
|
var tags = Tags;
|
||||||
if (tags == null || tags.Count == 0)
|
if (tags == null || tags.Count == 0)
|
||||||
{
|
{
|
||||||
|
Rows = 0;
|
||||||
Content = null;
|
Content = null;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue