Skip to content

Commit 6bb83e1

Browse files
committed
enhance: allows to move window by dragging toolbar (#1791)
Signed-off-by: leo <[email protected]>
1 parent 325b4f6 commit 6bb83e1

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/Views/LauncherPage.axaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@
1111
x:DataType="vm:LauncherPage">
1212
<Grid RowDefinitions="36,*">
1313
<!-- ToolBar -->
14-
<Border Grid.Row="0" BorderBrush="{DynamicResource Brush.Border0}" BorderThickness="0,0,0,1" Background="{DynamicResource Brush.ToolBar}">
14+
<Border Grid.Row="0"
15+
BorderBrush="{DynamicResource Brush.Border0}"
16+
BorderThickness="0,0,0,1"
17+
Background="{DynamicResource Brush.ToolBar}"
18+
PointerPressed="OnToolBarPointerPressed">
1519
<ContentControl Content="{Binding Data}">
1620
<ContentControl.DataTemplates>
1721
<DataTemplate DataType="vm:Welcome">

src/Views/LauncherPage.axaml.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using Avalonia.Input;
66
using Avalonia.Interactivity;
77
using Avalonia.LogicalTree;
8+
using Avalonia.VisualTree;
89

910
namespace SourceGit.Views
1011
{
@@ -93,5 +94,10 @@ private void OnPopupDataContextChanged(object sender, EventArgs e)
9394
presenter.Content = App.CreateViewForViewModel(presenter.DataContext);
9495
}
9596
}
97+
98+
private void OnToolBarPointerPressed(object sender, PointerPressedEventArgs e)
99+
{
100+
this.FindAncestorOfType<ChromelessWindow>()?.BeginMoveWindow(sender, e);
101+
}
96102
}
97103
}

0 commit comments

Comments
 (0)