ux: vertical align center

This commit is contained in:
leo 2024-08-22 21:23:05 +08:00
parent 38e2e0f3f4
commit 38770af13d
No known key found for this signature in database
2 changed files with 3 additions and 2 deletions

View file

@ -89,6 +89,7 @@
<ListBox.ItemTemplate> <ListBox.ItemTemplate>
<DataTemplate DataType="vm:RepositoryNode"> <DataTemplate DataType="vm:RepositoryNode">
<Grid Background="Transparent" <Grid Background="Transparent"
VerticalAlignment="Center"
ColumnDefinitions="16,18,Auto,*" ColumnDefinitions="16,18,Auto,*"
Margin="{Binding Depth, Converter={x:Static c:IntConverters.ToTreeMargin}}" Margin="{Binding Depth, Converter={x:Static c:IntConverters.ToTreeMargin}}"
Loaded="SetupTreeNodeDragAndDrop" Loaded="SetupTreeNodeDragAndDrop"

View file

@ -95,9 +95,9 @@ namespace SourceGit.Views
private void OnTreeNodeContextRequested(object sender, ContextRequestedEventArgs e) private void OnTreeNodeContextRequested(object sender, ContextRequestedEventArgs e)
{ {
if (sender is Grid grid) if (sender is Grid { DataContext: ViewModels.RepositoryNode node } grid)
{ {
var menu = ViewModels.Welcome.Instance.CreateContextMenu(grid.DataContext as ViewModels.RepositoryNode); var menu = ViewModels.Welcome.Instance.CreateContextMenu(node);
grid.OpenContextMenu(menu); grid.OpenContextMenu(menu);
e.Handled = true; e.Handled = true;
} }