Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/PlanViewer.App/Controls/QueryStoreGridControl.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@
Background="{DynamicResource BackgroundDarkBrush}"
BorderThickness="0"
Sorting="ResultsGrid_Sorting"
DoubleTapped="ResultsGrid_DoubleTapped"
ScrollViewer.HorizontalScrollBarVisibility="Auto">
<DataGrid.ContextMenu>
<ContextMenu Opening="ContextMenu_Opening">
Expand Down
18 changes: 18 additions & 0 deletions src/PlanViewer.App/Controls/QueryStoreGridControl.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@
using System.Linq;
using System.Runtime.CompilerServices;
using System.Threading;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.Primitives;
using Avalonia.Input;
using Avalonia.Interactivity;
using Avalonia.VisualTree;
using Avalonia.Media;
using PlanViewer.Core.Interfaces;
using PlanViewer.Core.Models;
Expand Down Expand Up @@ -758,6 +761,21 @@ private void ExpandRow_Click(object? sender, RoutedEventArgs e)
{
if (sender is not Button btn) return;
if (btn.DataContext is not QueryStoreRow row) return;
ToggleRowExpansion(row);
}

private void ResultsGrid_DoubleTapped(object? sender, TappedEventArgs e)
{
if (e.Source is not Visual v) return;
if (v.FindAncestorOfType<Button>() != null) return;
if (v.FindAncestorOfType<DataGridRow>() == null) return;
if (ResultsGrid.SelectedItem is not QueryStoreRow row) return;
if (!row.HasChildren) return;
ToggleRowExpansion(row);
}

private void ToggleRowExpansion(QueryStoreRow row)
{
if (!row.HasChildren) return;

row.IsExpanded = !row.IsExpanded;
Expand Down
28 changes: 28 additions & 0 deletions src/PlanViewer.App/MainWindow.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,23 @@ public MainWindow()
e.Handled = true;
}
break;
case Key.Tab:
var tabCount = MainTabControl.Items.Count;
if (tabCount > 1)
{
MainTabControl.SelectedIndex = (MainTabControl.SelectedIndex + 1) % tabCount;
e.Handled = true;
}
break;
}
}
else if (e.KeyModifiers == (KeyModifiers.Control | KeyModifiers.Shift) && e.Key == Key.Tab)
{
var tabCount = MainTabControl.Items.Count;
if (tabCount > 1)
{
MainTabControl.SelectedIndex = (MainTabControl.SelectedIndex - 1 + tabCount) % tabCount;
e.Handled = true;
}
}
}, RoutingStrategies.Tunnel);
Expand Down Expand Up @@ -824,13 +841,24 @@ private TabItem CreateTab(string label, Control content)
var header = new StackPanel
{
Orientation = Orientation.Horizontal,
Background = Brushes.Transparent,
Children = { headerText, closeBtn }
};

var tab = new TabItem { Header = header, Content = content };
closeBtn.Tag = tab;
closeBtn.Click += CloseTab_Click;

header.PointerPressed += (_, e) =>
{
if (e.GetCurrentPoint(null).Properties.PointerUpdateKind == PointerUpdateKind.MiddleButtonPressed)
{
MainTabControl.Items.Remove(tab);
UpdateEmptyOverlay();
e.Handled = true;
}
};

// Right-click context menu
var copyPathItem = new MenuItem { Header = "Copy Path", Tag = tab };
// Only visible when tab content has a file path
Expand Down