diff --git a/functions/public/Invoke-WPFUIElements.ps1 b/functions/public/Invoke-WPFUIElements.ps1 index 1c2324ae..18066e6a 100644 --- a/functions/public/Invoke-WPFUIElements.ps1 +++ b/functions/public/Invoke-WPFUIElements.ps1 @@ -45,13 +45,6 @@ function Invoke-WPFUIElements { $targetGrid.ColumnDefinitions.Add($colDef) | Out-Null } - # Only apply the logic for distributing entries across columns if the targetGridName is "appspanel" - if ($targetGridName -eq "appspanel") { - $panelcount = 0 - $entrycount = $configHashtable.Keys.Count + $organizedData["0"].Keys.Count - $maxcount = [Math]::Round($entrycount / $columncount + 0.5) - } - # Convert PSCustomObject to Hashtable $configHashtable = @{} $configVariable.PSObject.Properties.Name | ForEach-Object { @@ -90,6 +83,13 @@ function Invoke-WPFUIElements { # Store application data in an array under the category $organizedData[$entryObject.Panel][$entryObject.Category] += $entryObject + + # Only apply the logic for distributing entries across columns if the targetGridName is "appspanel" + if ($targetGridName -eq "appspanel") { + $panelcount = 0 + $entrycount = $configHashtable.Keys.Count + $organizedData["0"].Keys.Count + $maxcount = [Math]::Round($entrycount / $columncount + 0.5) + } } # Iterate through 'organizedData' by panel, category, and application