From 51d7350e35e44868b7de32cbbc1c7f2650614ea4 Mon Sep 17 00:00:00 2001 From: Gabi <218829269+GabiNun2@users.noreply.github.com> Date: Mon, 22 Jun 2026 12:28:39 -0700 Subject: [PATCH] Fix Add-SelectedAppsMenuItem's spaces (#4707) --- .../private/Add-SelectedAppsMenuItem.ps1 | 84 +++++++++---------- 1 file changed, 42 insertions(+), 42 deletions(-) diff --git a/functions/private/Add-SelectedAppsMenuItem.ps1 b/functions/private/Add-SelectedAppsMenuItem.ps1 index c52bb7c8..164d22be 100644 --- a/functions/private/Add-SelectedAppsMenuItem.ps1 +++ b/functions/private/Add-SelectedAppsMenuItem.ps1 @@ -1,50 +1,50 @@ - function Add-SelectedAppsMenuItem { - <# - .SYNOPSIS - This is a helper function that generates and adds the Menu Items to the Selected Apps Popup. +function Add-SelectedAppsMenuItem { + <# + .SYNOPSIS + This is a helper function that generates and adds the Menu Items to the Selected Apps Popup. - .Parameter name - The actual Name of an App like "Chrome" or "Brave" - This name is contained in the "Content" property inside the applications.json - .PARAMETER key - The key which identifies an app object in applications.json - For Chrome this would be "WPFInstallchrome" because "WPFInstall" is prepended automatically for each key in applications.json - #> + .Parameter name + The actual Name of an App like "Chrome" or "Brave" + This name is contained in the "Content" property inside the applications.json + .PARAMETER key + The key which identifies an app object in applications.json + For Chrome this would be "WPFInstallchrome" because "WPFInstall" is prepended automatically for each key in applications.json + #> - param ([string]$name, [string]$key) + param ([string]$name, [string]$key) - $selectedAppGrid = New-Object Windows.Controls.Grid + $selectedAppGrid = New-Object Windows.Controls.Grid - $selectedAppGrid.ColumnDefinitions.Add((New-Object System.Windows.Controls.ColumnDefinition -Property @{Width = "*"})) - $selectedAppGrid.ColumnDefinitions.Add((New-Object System.Windows.Controls.ColumnDefinition -Property @{Width = "30"})) + $selectedAppGrid.ColumnDefinitions.Add((New-Object System.Windows.Controls.ColumnDefinition -Property @{Width = "*"})) + $selectedAppGrid.ColumnDefinitions.Add((New-Object System.Windows.Controls.ColumnDefinition -Property @{Width = "30"})) - # Sets the name to the Content as well as the Tooltip, because the parent Popup Border has a fixed width and text could "overflow". - # With the tooltip, you can still read the whole entry on hover - $selectedAppLabel = New-Object Windows.Controls.Label - $selectedAppLabel.Content = $name - $selectedAppLabel.ToolTip = $name - $selectedAppLabel.HorizontalAlignment = "Left" - $selectedAppLabel.SetResourceReference([Windows.Controls.Control]::ForegroundProperty, "MainForegroundColor") - [System.Windows.Controls.Grid]::SetColumn($selectedAppLabel, 0) - $selectedAppGrid.Children.Add($selectedAppLabel) + # Sets the name to the Content as well as the Tooltip, because the parent Popup Border has a fixed width and text could "overflow". + # With the tooltip, you can still read the whole entry on hover + $selectedAppLabel = New-Object Windows.Controls.Label + $selectedAppLabel.Content = $name + $selectedAppLabel.ToolTip = $name + $selectedAppLabel.HorizontalAlignment = "Left" + $selectedAppLabel.SetResourceReference([Windows.Controls.Control]::ForegroundProperty, "MainForegroundColor") + [System.Windows.Controls.Grid]::SetColumn($selectedAppLabel, 0) + $selectedAppGrid.Children.Add($selectedAppLabel) - $selectedAppRemoveButton = New-Object Windows.Controls.Button - $selectedAppRemoveButton.FontFamily = "Segoe MDL2 Assets" - $selectedAppRemoveButton.Content = [string]([char]0xE711) - $selectedAppRemoveButton.HorizontalAlignment = "Center" - $selectedAppRemoveButton.Tag = $key - $selectedAppRemoveButton.ToolTip = "Remove the App from Selection" - $selectedAppRemoveButton.SetResourceReference([Windows.Controls.Control]::ForegroundProperty, "MainForegroundColor") - $selectedAppRemoveButton.SetResourceReference([Windows.Controls.Control]::StyleProperty, "HoverButtonStyle") + $selectedAppRemoveButton = New-Object Windows.Controls.Button + $selectedAppRemoveButton.FontFamily = "Segoe MDL2 Assets" + $selectedAppRemoveButton.Content = [string]([char]0xE711) + $selectedAppRemoveButton.HorizontalAlignment = "Center" + $selectedAppRemoveButton.Tag = $key + $selectedAppRemoveButton.ToolTip = "Remove the App from Selection" + $selectedAppRemoveButton.SetResourceReference([Windows.Controls.Control]::ForegroundProperty, "MainForegroundColor") + $selectedAppRemoveButton.SetResourceReference([Windows.Controls.Control]::StyleProperty, "HoverButtonStyle") - # Highlight the Remove icon on Hover - $selectedAppRemoveButton.Add_MouseEnter({ $this.Foreground = "Red" }) - $selectedAppRemoveButton.Add_MouseLeave({ $this.SetResourceReference([Windows.Controls.Control]::ForegroundProperty, "MainForegroundColor") }) - $selectedAppRemoveButton.Add_Click({ + # Highlight the Remove icon on Hover + $selectedAppRemoveButton.Add_MouseEnter({ $this.Foreground = "Red" }) + $selectedAppRemoveButton.Add_MouseLeave({ $this.SetResourceReference([Windows.Controls.Control]::ForegroundProperty, "MainForegroundColor") }) + $selectedAppRemoveButton.Add_Click({ $sync.($this.Tag).isChecked = $false # On click of the remove button, we only have to uncheck the corresponding checkbox. This will kick of all necessary changes to update the UI - }) - [System.Windows.Controls.Grid]::SetColumn($selectedAppRemoveButton, 1) - $selectedAppGrid.Children.Add($selectedAppRemoveButton) - # Add new Element to Popup - $sync.selectedAppsstackPanel.Children.Add($selectedAppGrid) - } + }) + [System.Windows.Controls.Grid]::SetColumn($selectedAppRemoveButton, 1) + $selectedAppGrid.Children.Add($selectedAppRemoveButton) + # Add new Element to Popup + $sync.selectedAppsstackPanel.Children.Add($selectedAppGrid) +}