diff --git a/functions/private/Initialize-InstallCategoryAppList.ps1 b/functions/private/Initialize-InstallCategoryAppList.ps1 index 1272316a..6daded27 100644 --- a/functions/private/Initialize-InstallCategoryAppList.ps1 +++ b/functions/private/Initialize-InstallCategoryAppList.ps1 @@ -24,7 +24,9 @@ function Initialize-InstallCategoryAppList { $toggleButton = New-Object Windows.Controls.Label $toggleButton.Content = "$Category" $toggleButton.Tag = "CategoryToggleButton" - $sync.$Category = $Category + $toggleButton.SetResourceReference([Windows.Controls.Control]::FontSizeProperty, "HeaderFontSize") + $toggleButton.SetResourceReference([Windows.Controls.Control]::FontFamilyProperty, "HeaderFontFamily") + $sync.$Category = $toggleButton $null = $TargetElement.Items.Add($toggleButton) } diff --git a/functions/public/Invoke-WPFUIElements.ps1 b/functions/public/Invoke-WPFUIElements.ps1 index 09764404..6c35e529 100644 --- a/functions/public/Invoke-WPFUIElements.ps1 +++ b/functions/public/Invoke-WPFUIElements.ps1 @@ -140,6 +140,7 @@ function Invoke-WPFUIElements { $label.Content = $category -replace ".*__", "" $label.SetResourceReference([Windows.Controls.Control]::FontSizeProperty, "HeaderFontSize") $label.SetResourceReference([Windows.Controls.Control]::FontFamilyProperty, "HeaderFontFamily") + $label.UseLayoutRounding = $true $itemsControl.Items.Add($label) | Out-Null $sync[$category] = $label @@ -154,6 +155,7 @@ function Invoke-WPFUIElements { $checkBox = New-Object Windows.Controls.CheckBox $checkBox.Name = $entryInfo.Name $checkBox.HorizontalAlignment = "Right" + $checkBox.UseLayoutRounding = $true $dockPanel.Children.Add($checkBox) | Out-Null $checkBox.Style = $ColorfulToggleSwitchStyle @@ -163,6 +165,7 @@ function Invoke-WPFUIElements { $label.HorizontalAlignment = "Left" $label.SetResourceReference([Windows.Controls.Control]::FontSizeProperty, "FontSize") $label.SetResourceReference([Windows.Controls.Control]::ForegroundProperty, "MainForegroundColor") + $label.UseLayoutRounding = $true $dockPanel.Children.Add($label) | Out-Null $itemsControl.Items.Add($dockPanel) | Out-Null @@ -217,6 +220,7 @@ function Invoke-WPFUIElements { $label.HorizontalAlignment = "Left" $label.VerticalAlignment = "Center" $label.SetResourceReference([Windows.Controls.Control]::FontSizeProperty, "ButtonFontSize") + $label.UseLayoutRounding = $true $horizontalStackPanel.Children.Add($label) | Out-Null $comboBox = New-Object Windows.Controls.ComboBox @@ -226,11 +230,14 @@ function Invoke-WPFUIElements { $comboBox.HorizontalAlignment = "Left" $comboBox.VerticalAlignment = "Center" $comboBox.SetResourceReference([Windows.Controls.Control]::MarginProperty, "ButtonMargin") + $comboBox.SetResourceReference([Windows.Controls.Control]::FontSizeProperty, "ButtonFontSize") + $comboBox.UseLayoutRounding = $true foreach ($comboitem in ($entryInfo.ComboItems -split " ")) { $comboBoxItem = New-Object Windows.Controls.ComboBoxItem $comboBoxItem.Content = $comboitem $comboBoxItem.SetResourceReference([Windows.Controls.Control]::FontSizeProperty, "ButtonFontSize") + $comboBoxItem.UseLayoutRounding = $true $comboBox.Items.Add($comboBoxItem) | Out-Null } @@ -239,6 +246,19 @@ function Invoke-WPFUIElements { $comboBox.SelectedIndex = 0 + # Set initial text + if ($comboBox.Items.Count -gt 0) { + $comboBox.Text = $comboBox.Items[0].Content + } + + # Add SelectionChanged event handler to update the text property + $comboBox.Add_SelectionChanged({ + $selectedItem = $this.SelectedItem + if ($selectedItem) { + $this.Text = $selectedItem.Content + } + }) + $sync[$entryInfo.Name] = $comboBox } @@ -250,7 +270,8 @@ function Invoke-WPFUIElements { $button.SetResourceReference([Windows.Controls.Control]::MarginProperty, "ButtonMargin") $button.SetResourceReference([Windows.Controls.Control]::FontSizeProperty, "ButtonFontSize") if ($entryInfo.ButtonWidth) { - $button.Width = $entryInfo.ButtonWidth + $baseWidth = [int]$entryInfo.ButtonWidth + $button.Width = [math]::Max($baseWidth, 350) } $itemsControl.Items.Add($button) | Out-Null @@ -281,6 +302,7 @@ function Invoke-WPFUIElements { $radioButton.SetResourceReference([Windows.Controls.Control]::MarginProperty, "CheckBoxMargin") $radioButton.SetResourceReference([Windows.Controls.Control]::FontSizeProperty, "ButtonFontSize") $radioButton.ToolTip = $entryInfo.Description + $radioButton.UseLayoutRounding = $true if ($entryInfo.Checked -eq $true) { $radioButton.IsChecked = $true @@ -301,6 +323,7 @@ function Invoke-WPFUIElements { $checkBox.SetResourceReference([Windows.Controls.Control]::FontSizeProperty, "FontSize") $checkBox.ToolTip = $entryInfo.Description $checkBox.SetResourceReference([Windows.Controls.Control]::MarginProperty, "CheckBoxMargin") + $checkBox.UseLayoutRounding = $true if ($entryInfo.Checked -eq $true) { $checkBox.IsChecked = $entryInfo.Checked } @@ -312,6 +335,7 @@ function Invoke-WPFUIElements { $textBlock.Text = "(?)" $textBlock.ToolTip = $entryInfo.Link $textBlock.Style = $HoverTextBlockStyle + $textBlock.UseLayoutRounding = $true $horizontalStackPanel.Children.Add($textBlock) | Out-Null diff --git a/xaml/inputXML.xaml b/xaml/inputXML.xaml index 40422b15..67a9f200 100644 --- a/xaml/inputXML.xaml +++ b/xaml/inputXML.xaml @@ -10,8 +10,8 @@ WindowStyle="None" Width="Auto" Height="Auto" - MaxWidth="1380" - MaxHeight="800" + MinWidth="800" + MinHeight="600" Title="WinUtil"> @@ -534,11 +534,18 @@ Height="{DynamicResource CheckBoxBulletDecoratorSize *0.85}" Margin="2" SnapsToDevicePixels="True"/> - + + + - + @@ -569,22 +576,24 @@ - - - - + + + + + + @@ -892,63 +901,69 @@ - - + + - - + + + + + + + + + + + + + + Install + + + + + + + Tweaks + + + + + + + Config + + + + + + + Updates + + + + + + + MicroWin + + + - - - - Install - - - - - - - Tweaks - - - - - - - Config - - - - - - - Updates - - - - - - - MicroWin - - - - + + + - - - - - - + + - - -  - + + + + +  + + + + +