From 1e068f05c206f013118aca8cde0bc3ea2bb87d77 Mon Sep 17 00:00:00 2001 From: Harald Daltveit Date: Sat, 13 Jun 2026 01:24:48 +0200 Subject: [PATCH] fix(controls): Restore direct TextElement.Foreground setters in Button ControlTemplate triggers Commit 4c711b6a (v4.2.1) changed the IsPressed and Disabled ControlTemplate triggers to set Foreground on the TemplatedParent instead of directly setting TextElement.Foreground on the ContentPresenter and ControlIcon elements. This relied on {TemplateBinding Foreground} to propagate the value, but TemplateBinding does not always properly reflect trigger-set values on the templated parent. In dark theme, this caused the button foreground to show the wrong color when pressed (falling back to the PressedForeground DP default of SystemColors.ControlTextBrush instead of the Style-set ButtonForegroundPressed resource). The fix restores the working approach from v4.2.0: directly targeting ContentPresenter and ControlIcon with TextElement.Foreground in both the IsPressed MultiTrigger and the IsEnabled (Disabled) Trigger. Fixes #1722 --- src/Wpf.Ui/Controls/Button/Button.xaml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Wpf.Ui/Controls/Button/Button.xaml b/src/Wpf.Ui/Controls/Button/Button.xaml index c6e22b914..863f64585 100644 --- a/src/Wpf.Ui/Controls/Button/Button.xaml +++ b/src/Wpf.Ui/Controls/Button/Button.xaml @@ -460,7 +460,8 @@ - + + @@ -477,7 +478,8 @@ - + +