From 989ffe1c1d105f73c60ef6f773c4a097a46ceb12 Mon Sep 17 00:00:00 2001
From: jfacemyer <1776340+jfacemyer@users.noreply.github.com>
Date: Thu, 8 Oct 2026 06:57:01 -0400
Subject: [PATCH] WineFix: fill the empty Leading dropdown in the text context
toolbar
Affinity 3.3 merged ReflectedLayoutItemTemplates.xaml into
ContextBarItemTemplates.xaml. Its implicit CheckedComboBoxItem style has an
empty ControlTemplate, and the merged dictionary is searched before the
application's Core.xaml, so LeadingComboItemStyle and
CheckedComboBoxItemStyle (BasedOn the implicit style, no template of their
own) inherit nothing. The Leading dropdown opens with zero height.
Replacing the dictionary entries is not enough, because the context bar's
DataTemplates keep the style objects their StaticResource references were
bound to. Instead, when a CheckedComboBox applies its template, swap an
ItemContainerStyle whose inherited template is empty for a copy BasedOn
Core.xaml's style. Styles with a real template are untouched, and the patch
does nothing once the XAML is fixed. Affinity 3.2.3 does not have the merge.
---
WineFix/Patches/ContextBarItemStylePatch.cs | 148 ++++++++++++++++++++
WineFix/WineFixPlugin.cs | 15 ++
2 files changed, 163 insertions(+)
create mode 100644 WineFix/Patches/ContextBarItemStylePatch.cs
diff --git a/WineFix/Patches/ContextBarItemStylePatch.cs b/WineFix/Patches/ContextBarItemStylePatch.cs
new file mode 100644
index 0000000..b84c8ca
--- /dev/null
+++ b/WineFix/Patches/ContextBarItemStylePatch.cs
@@ -0,0 +1,148 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Windows;
+using System.Windows.Controls;
+using HarmonyLib;
+using AffinityPluginLoader.Core;
+
+namespace WineFix.Patches
+{
+ ///
+ /// Fixes the empty Leading dropdown in the text context toolbar (Affinity 3.3).
+ ///
+ /// LeadingComboItemStyle and CheckedComboBoxItemStyle in ContextBarItemTemplates.xaml set
+ /// no template of their own; they are BasedOn the implicit CheckedComboBoxItem style and
+ /// expect Core.xaml's. Affinity 3.3 merged ReflectedLayoutItemTemplates.xaml into the same
+ /// dictionary, and its implicit CheckedComboBoxItem style has an empty ControlTemplate (a
+ /// base its own derived styles replace). The merged dictionary is searched first, so the
+ /// dropdown items get no visual tree and the list opens with zero height.
+ ///
+ /// Replacing the dictionary entries does not help: the context bar's DataTemplates keep the
+ /// style objects their StaticResource references were bound to. Instead, when a
+ /// CheckedComboBox applies its template, an ItemContainerStyle whose inherited template is
+ /// empty is swapped for a copy BasedOn Core.xaml's style. Styles with a real template,
+ /// including Reflected's own, are left alone, as is everything once Serif fixes the XAML.
+ ///
+ public static class ContextBarItemStylePatch
+ {
+ private static readonly Dictionary