Skip to content

Commit

Permalink
Fix: Window Statechange on doubleclick works everywhere (#2768)
Browse files Browse the repository at this point in the history
* Run the Doubleclick action only on Grid and Stackpanel and cleanup the logic

* Remove ternary operator because it is only supported for powershell 7+
  • Loading branch information
Marterich authored Sep 20, 2024
1 parent b3bbe0d commit 9136ed9
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions scripts/main.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -255,10 +255,14 @@ $sync["Form"].Add_MouseLeftButtonDown({
})

$sync["Form"].Add_MouseDoubleClick({
if ($sync["Form"].WindowState -eq [Windows.WindowState]::Normal) {
$sync["Form"].WindowState = [Windows.WindowState]::Maximized;
} else {
$sync["Form"].WindowState = [Windows.WindowState]::Normal;
if ($_.OriginalSource -is [System.Windows.Controls.Grid] -or
$_.OriginalSource -is [System.Windows.Controls.StackPanel]) {
if ($sync["Form"].WindowState -eq [Windows.WindowState]::Normal){
$sync["Form"].WindowState = [Windows.WindowState]::Maximized
}
else{
$sync["Form"].WindowState = [Windows.WindowState]::Normal
}
}
})

Expand Down

0 comments on commit 9136ed9

Please sign in to comment.