Fix: Window Statechange on doubleclick works everywhere (#2768)

* Run the Doubleclick action only on Grid and Stackpanel and cleanup the logic

* Remove ternary operator because it is only supported for powershell 7+
This commit is contained in:
Martin Wiethan 2024-09-20 15:32:41 +02:00 committed by GitHub
parent b3bbe0dbe5
commit 9136ed9802
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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
}
}
})