Refactor checkbox style assignment in config window

This commit is contained in:
Raphire
2026-03-27 20:36:16 +01:00
parent bd16457552
commit f8f85ca861

View File

@@ -44,14 +44,6 @@ function Show-ImportExportConfigWindow {
$dlg.Owner = $Owner $dlg.Owner = $Owner
SetWindowThemeResources -window $dlg -usesDarkMode $UsesDarkMode SetWindowThemeResources -window $dlg -usesDarkMode $UsesDarkMode
# Copy the CheckBox default style from the main window so checkboxes get the themed template
try {
$mainCheckBoxStyle = $Owner.FindResource([type][System.Windows.Controls.CheckBox])
if ($mainCheckBoxStyle) {
$dlg.Resources.Add([type][System.Windows.Controls.CheckBox], $mainCheckBoxStyle)
}
} catch { }
# Populate named elements # Populate named elements
$dlg.Title = $Title $dlg.Title = $Title
$dlg.FindName('TitleText').Text = $Title $dlg.FindName('TitleText').Text = $Title
@@ -70,6 +62,7 @@ function Show-ImportExportConfigWindow {
$cb.Margin = [System.Windows.Thickness]::new(0,0,0,8) $cb.Margin = [System.Windows.Thickness]::new(0,0,0,8)
$cb.FontSize = 14 $cb.FontSize = 14
$cb.Foreground = $dlg.FindResource('FgColor') $cb.Foreground = $dlg.FindResource('FgColor')
$cb.Style = $window.Resources["AppsPanelCheckBoxStyle"]
if ($DisabledCategories -contains $cat) { if ($DisabledCategories -contains $cat) {
$cb.IsChecked = $false $cb.IsChecked = $false
$cb.IsEnabled = $false $cb.IsEnabled = $false