From b9ce591d22d0f6114de2036bea048fa022318856 Mon Sep 17 00:00:00 2001 From: "j.foucher" Date: Sat, 2 May 2026 13:44:00 +0200 Subject: [PATCH] ComboBox fixes: clickable center + display the option name, not the record MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two issues with the language picker after the dark restyling: 1. Click on the center of the ComboBox was a no-op — only the arrow triggered the dropdown. The previous template had a separate ToggleButton in column 1 covering only the arrow region. New template wraps the entire body in a single ToggleButton (with its own template carrying the border + arrow), and the ContentPresenter for the selected text floats on top with IsHitTestVisible="False" so clicks pass through to the toggle. 2. Selected item showed "LanguageOption { Code = auto, Name = ... }" instead of just the name. C# record types stringify with property names by default. Override LanguageOption.ToString() to return Name so the SelectionBox falls back to a clean label even though DisplayMemberPath="Name" is set on the dropdown items. Co-Authored-By: Claude Opus 4.7 (1M context) --- src/PSLauncher.App/Resources/Theme.xaml | 74 +++++++++++-------- .../ViewModels/SettingsViewModel.cs | 7 +- 2 files changed, 49 insertions(+), 32 deletions(-) diff --git a/src/PSLauncher.App/Resources/Theme.xaml b/src/PSLauncher.App/Resources/Theme.xaml index 52be53f..260f084 100644 --- a/src/PSLauncher.App/Resources/Theme.xaml +++ b/src/PSLauncher.App/Resources/Theme.xaml @@ -243,29 +243,49 @@ - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - diff --git a/src/PSLauncher.App/ViewModels/SettingsViewModel.cs b/src/PSLauncher.App/ViewModels/SettingsViewModel.cs index 447496f..ec6be44 100644 --- a/src/PSLauncher.App/ViewModels/SettingsViewModel.cs +++ b/src/PSLauncher.App/ViewModels/SettingsViewModel.cs @@ -13,7 +13,12 @@ using PSLauncher.Models; namespace PSLauncher.App.ViewModels; -public sealed record LanguageOption(string Code, string Name); +public sealed record LanguageOption(string Code, string Name) +{ + // Override pour que la SelectionBox d'un ComboBox affiche le libellé clair + // (sinon WPF affiche la forme record "LanguageOption { Code = ..., Name = ... }"). + public override string ToString() => Name; +} public sealed partial class SettingsViewModel : ObservableObject {