ComboBox fixes: clickable center + display the option name, not the record

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) <noreply@anthropic.com>
This commit is contained in:
2026-05-02 13:44:00 +02:00
parent 5d0284f1db
commit b9ce591d22
2 changed files with 49 additions and 32 deletions

View File

@@ -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
{