Skip to content

Commit be1c200

Browse files
Merge pull request #21 from primitivoJordan/window-dragging-feature
Add window dragging functionality to title bar
2 parents 023d601 + d71bb57 commit be1c200

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

MacUtilGUI/Views/MainWindow.axaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<Border Background="#80000000" Padding="20" Classes="macos-window" CornerRadius="15">
2424
<Grid RowDefinitions="Auto,*">
2525
<!-- macOS Title Bar -->
26-
<Grid Grid.Row="0" ColumnDefinitions="Auto,*,Auto" Height="32" Margin="-20,-20,-20,0" Background="#80000000">
26+
<Grid Grid.Row="0" ColumnDefinitions="Auto,*,Auto" Height="32" Margin="-20,-20,-20,0" Background="#80000000" PointerPressed="TitleBar_PointerPressed">
2727
<!-- Window Controls -->
2828
<StackPanel Grid.Column="0" Orientation="Horizontal" Margin="16,6,0,0" Spacing="8">
2929
<Button Width="12" Height="12" CornerRadius="6" Background="#FF5F57" Classes="macos-window-control" Cursor="Hand" Click="OnCloseButtonClick"/>

MacUtilGUI/Views/MainWindow.axaml.fs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ namespace MacUtilGUI.Views
33
open System.Windows.Input
44
open Avalonia
55
open Avalonia.Controls
6+
open Avalonia.Input
67
open Avalonia.Markup.Xaml
78
open Avalonia.Interactivity
89
open MacUtilGUI.ViewModels
@@ -38,3 +39,6 @@ type MainWindow() as this =
3839
| _ -> ()
3940
| _ -> ()
4041
| _ -> ()
42+
43+
member private this.TitleBar_PointerPressed(sender: obj, e: PointerPressedEventArgs) =
44+
this.BeginMoveDrag(e)

0 commit comments

Comments
 (0)