Skip to content

[Windows] Fix SearchHandler FontSize, FontFamily, VerticalTextAlignment, and FontAttributes are not applied - #36700

Merged
kubaflo merged 7 commits into
dotnet:inflight/currentfrom
devanathan-vaithiyanathan:fix-36629
Jul 26, 2026
Merged

[Windows] Fix SearchHandler FontSize, FontFamily, VerticalTextAlignment, and FontAttributes are not applied #36700
kubaflo merged 7 commits into
dotnet:inflight/currentfrom
devanathan-vaithiyanathan:fix-36629

Conversation

@devanathan-vaithiyanathan

Copy link
Copy Markdown
Contributor

Note

Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!

Issue Details

On Windows, the following SearchHandler properties were silently ignored: FontSize, FontFamily, and FontAttributes.

Description of Changes:

  • AutoSuggestBoxExtensions.cs — Added UpdateSearchHandlerFont() extension method that delegates to UpdateFont(searchHandler.ToFont(), fontManager).
  • ShellItemHandler.Windows.cs — Called UpdateSearchHandlerFont on initial SearchHandler attach, and added case branches for FontFamily, FontSize, and FontAttributes in the property-changed handler.

Description of Change

Issues Fixed

Fixes #36629

Tested the behavior in the following platforms.

  • Android
  • Windows
  • iOS
  • Mac
Before After
Windows
Before.mp4
Windows
After.mp4

@github-actions

Copy link
Copy Markdown
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 36700

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 36700"

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
There may be pipelines that require an authorized user to comment /azp run to run.

@dotnet-policy-service dotnet-policy-service Bot added the partner/syncfusion Issues / PR's with Syncfusion collaboration label Jul 21, 2026
@devanathan-vaithiyanathan devanathan-vaithiyanathan added the community ✨ Community Contribution label Jul 21, 2026
@sheiksyedm
sheiksyedm marked this pull request as ready for review July 22, 2026 14:28
Copilot AI review requested due to automatic review settings July 22, 2026 14:28
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
There may be pipelines that require an authorized user to comment /azp run to run.

@sheiksyedm

Copy link
Copy Markdown
Contributor

/azp run maui-pr-uitests , maui-pr-devicetests

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 2 pipeline(s).

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes missing application of SearchHandler font-related properties on Windows by updating the WinUI AutoSuggestBox when a SearchHandler is attached and when relevant properties change, and adds a UI test page + screenshot test for regression coverage.

Changes:

  • Add a Windows AutoSuggestBox extension to update the SearchHandler font via IFontManager.
  • Apply SearchHandler font updates during initial attach and on FontFamily/FontSize/FontAttributes changes in ShellItemHandler (Windows).
  • Add HostApp repro page + UITest screenshot coverage for issue #36629.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue36629.cs Adds a screenshot-based UI regression test for the SearchHandler font/alignment scenario.
src/Controls/tests/TestCases.HostApp/Issues/Issue36629.cs Adds a HostApp Shell-based repro page configuring SearchHandler font/alignment properties.
src/Controls/src/Core/Platform/Windows/Extensions/AutoSuggestBoxExtensions.cs Adds UpdateSearchHandlerFont(...) to apply SearchHandler font settings to WinUI AutoSuggestBox.
src/Controls/src/Core/Handlers/Shell/ShellItemHandler.Windows.cs Applies font updates on SearchHandler attach and when font-related properties change.

Comment thread src/Controls/tests/TestCases.HostApp/Issues/Issue36629.cs Outdated
Comment thread src/Controls/tests/TestCases.HostApp/Issues/Issue36629.cs
Copilot AI review requested due to automatic review settings July 23, 2026 08:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

Comment on lines +547 to +551
case nameof(SearchHandler.FontFamily):
case nameof(SearchHandler.FontSize):
case nameof(SearchHandler.FontAttributes):
autoSuggestBox.UpdateSearchHandlerFont(_currentSearchHandler, this.GetRequiredService<IFontManager>());
break;
Comment on lines +16 to +18
{
// Wait for the page to load
App.WaitForElement("ContentLabel36629");
@kubaflo

This comment has been minimized.

@github-actions github-actions Bot added the s/agent-review-in-progress AI review is currently running for this PR label Jul 23, 2026
@MauiBot MauiBot added s/agent-changes-requested AI agent recommends changes - found a better alternative or issues s/agent-fix-pr-picked AI could not beat the PR fix - PR is the best among all candidates s/agent-reviewed PR was reviewed by AI agent workflow (full 4-phase review) labels Jul 23, 2026
MauiBot

This comment was marked as outdated.

@MauiBot MauiBot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expert Review — 2 findings

See inline comments for details.

Comment thread src/Controls/src/Core/Handlers/Shell/ShellItemHandler.Windows.cs
@MauiBot MauiBot removed the s/agent-review-in-progress AI review is currently running for this PR label Jul 23, 2026

@kubaflo kubaflo left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please check the ai's suggestions?

@kubaflo

kubaflo commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).

Copilot AI review requested due to automatic review settings July 24, 2026 10:16
@devanathan-vaithiyanathan

Copy link
Copy Markdown
Contributor Author

Could you please check the ai's suggestions?

@kubaflo , I have addressed the AI suggestions

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 8 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (2)

src/Controls/src/Core/Handlers/Shell/ShellItemHandler.Windows.cs:551

  • FontAutoScalingEnabled is part of SearchHandler’s font state (IFontElement) and affects Windows text scaling via ControlExtensions.UpdateFont. The property-changed switch updates the font for FontFamily/FontSize/FontAttributes but ignores FontAutoScalingEnabled, so toggling it at runtime will not apply to the AutoSuggestBox.
				case nameof(SearchHandler.FontFamily):
				case nameof(SearchHandler.FontSize):
				case nameof(SearchHandler.FontAttributes):
					autoSuggestBox.UpdateSearchHandlerFont(_currentSearchHandler, this.GetRequiredService<IFontManager>());
					break;

src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue36629.cs:4

  • This test targets a Windows-specific issue (HostApp page is PlatformAffected.UWP), but the test will currently compile/run on all platforms. In this repo, Windows-only issue tests typically guard the whole file with #if WINDOWS (e.g., TestCases.Shared.Tests/Tests/Issues/Issue33171.cs), which avoids requiring per-platform screenshot baselines and reduces unrelated failures.
using NUnit.Framework;
using UITest.Appium;
using UITest.Core;

@MauiBot MauiBot added s/agent-gate-passed AI verified tests catch the bug (fail without fix, pass with fix) s/agent-fix-win AI found a better alternative fix than the PR and removed s/agent-fix-pr-picked AI could not beat the PR fix - PR is the best among all candidates labels Jul 26, 2026

@MauiBot MauiBot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI Review Summary

@devanathan-vaithiyanathan — new AI review results are available based on this last commit: 7cef31c.

Gate Passed Confidence Low Platform Windows


🗂️ Review Sessions — click to expand
🚦 Gate — Test Before & After Fix

Gate Result: ✅ PASSED

Platform: WINDOWS · Base: main · Merge base: 04f72196

Test Without Fix (expect FAIL) With Fix (expect PASS)
🖥️ Issue36629 Issue36629 ✅ FAIL — 560s ✅ PASS — 460s
🔴 Without fix — 🖥️ Issue36629: FAIL ✅ · 560s

Error-relevant lines (filtered from the build log):

     at VisualTestUtils.VisualRegressionTester.Fail(String message) in /_/src/TestUtils/src/VisualTestUtils/VisualRegressionTester.cs:line 162
   at VisualTestUtils.VisualRegressionTester.VerifyMatchesSnapshot(String name, ImageSnapshot actualImage, String environmentName, ITestContext testContext) in /_/src/TestUtils/src/VisualTestUtils/VisualRegressionTester.cs:line 123
   at Microsoft.Maui.TestCases.Tests.UITest.<VerifyScreenshot>g__Verify|13_0(String name, <>c__DisplayClass13_0&) in /_/src/Controls/tests/TestCases.Shared.Tests/UITest.cs:line 477
   at Microsoft.Maui.TestCases.Tests.UITest.VerifyScreenshot(String name, Nullable`1 retryDelay, Nullable`1 retryTimeout, Int32 cropLeft, Int32 cropRight, Int32 cropTop, Int32 cropBottom, Double tolerance, Boolean includeTitleBar) in /_/src/Controls/tests/TestCases.Shared.Tests/UITest.cs:line 309
   at Microsoft.Maui.TestCases.Tests.Issues.Issue36629.SearchHandlerFontPropertiesShouldBeApplied() in /_/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue36629.cs:line 22
   at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args)
   at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
🟢 With fix — 🖥️ Issue36629: PASS ✅ · 460s

(no coded error found; showing last 1200 chars)

0.1 (x64)

Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
NUnit Adapter 4.5.0.0: Test execution started
Running selected tests in D:\a\1\s\artifacts\bin\Controls.TestCases.WinUI.Tests\Debug\net10.0\Controls.TestCases.WinUI.Tests.dll
   NUnit3TestExecutor discovered 1 of 1 NUnit test cases using Current Discovery mode, Non-Explicit run
>>>>> 7/26/2026 2:59:25 PM FixtureSetup for Issue36629(Windows)
>>>>> 7/26/2026 2:59:38 PM SearchHandlerFontPropertiesShouldBeApplied Start
>>>>> 7/26/2026 2:59:38 PM SearchHandlerFontPropertiesShouldBeApplied Stop
  Passed SearchHandlerFontPropertiesShouldBeApplied [585 ms]
NUnit Adapter 4.5.0.0: Test execution complete
[xUnit.net 00:00:00.00] xUnit.net VSTest Adapter v2.8.2+699d445a1a (64-bit .NET 10.0.0)
[xUnit.net 00:00:00.11]   Discovering: Controls.TestCases.WinUI.Tests
[xUnit.net 00:00:00.33]   Discovered:  Controls.TestCases.WinUI.Tests
Results File: D:\a\1\s\CustomAgentLogsTmp\UITests\TestResults\Issue36629.trx

Test Run Successful.
Total tests: 1
     Passed: 1
 Total time: 25.2844 Seconds
>>> TRX_RESULT_FILE: D:\a\1\s\CustomAgentLogsTmp\UITests\TestResults\Issue36629.trx

📁 Fix files reverted (2 files)
  • src/Controls/src/Core/Handlers/Shell/ShellItemHandler.Windows.cs
  • src/Controls/src/Core/Platform/Windows/Extensions/AutoSuggestBoxExtensions.cs

📱 UI Tests — Shell

Detected UI test categories: Shell

Deep UI tests — 276 passed, 0 failed across 1 category on platform-pool agent (replaces in-process counts above).

🧪 UI Test Execution Results (deep, platform pool)

Category Tests Snapshot diffs
Shell 276/276 ✓
📎 Download drop-deep-uitests artifact (TRX + snapshot diffs)

📋 Pre-Flight — Context & Validation

Issue: #36629 - [Windows] SearchHandler FontSize, FontFamily, VerticalTextAlignment, and FontAttributes are not applied
PR: #36700 - [Windows] Fix SearchHandler FontSize, FontFamily, VerticalTextAlignment, and FontAttributes are not applied
Platforms Affected: Windows
Files Changed: 2 implementation, 6 test/snapshot

Key Findings

  • The checked-out review commit for PR #36700 modifies Windows Shell SearchHandler font application in ShellItemHandler.Windows.cs and AutoSuggestBoxExtensions.cs, plus visual UI coverage for issue #36629.
  • Public GitHub API metadata matched the SearchHandler PR, while local uncommitted worktree changes include unrelated review-pipeline files; candidate work should avoid those unrelated dirty files.
  • Gate was already completed externally: tests fail without the PR fix and pass with the PR fix. Per instructions, gate was not rerun and gate/content.md was not touched.
  • Targeted verification surface for candidates: Windows UI test Issue36629.SearchHandlerFontPropertiesShouldBeApplied / Shell category; local environment may be blocked if Windows app test dependencies are unavailable.

Code Review Summary

Verdict: NEEDS_CHANGES
Confidence: low
Errors: 1 | Warnings: 1 | Suggestions: 1

Key code review findings:

  • src/Controls/src/Core/Handlers/Shell/ShellItemHandler.Windows.cs:547-550 omits SearchHandler.FontAutoScalingEnabled from runtime font refresh cases, so toggling font auto-scaling after handler creation leaves the native AutoSuggestBox stale.
  • src/Controls/tests/TestCases.iOS.Tests/snapshots/ios-26/SearchHandlerFontPropertiesShouldBeApplied.png adds only the iOS 26 baseline; older iOS snapshot coverage may be missing.
  • src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue36629.cs:22 could use screenshot retry timeout for Shell visual stability.

Fix Candidates

# Source Approach Test Result Files Changed Notes
PR PR #36700 Apply SearchHandler font on initial Windows Shell search box hookup and on selected font property changes. ✅ PASSED (Gate) ShellItemHandler.Windows.cs, AutoSuggestBoxExtensions.cs, UI test/snapshots Original PR; pre-flight review found missing runtime FontAutoScalingEnabled refresh.

🔬 Code Review — Deep Analysis

Code Review — PR #36700

Independent Assessment

What this changes: Applies Windows SearchHandler font properties to the Shell AutoSuggestBox during initial hookup and when FontFamily, FontSize, or FontAttributes change. Adds screenshot UI coverage.
Inferred motivation: Windows Shell search ignored several SearchHandler font-related properties.

Reconciliation with PR Narrative

Author claims: Fixes Windows SearchHandler FontSize, FontFamily, VerticalTextAlignment, and FontAttributes.
Agreement/disagreement: The implementation matches most claims. VerticalTextAlignment already had update code; the new font refresh path is incomplete for FontAutoScalingEnabled.

Prior Review Reconciliation

Prior ❌ Error Finding Source Status Evidence
Missing FontAutoScalingEnabled runtime refresh MauiBot/Copilot inline comments ❌ Unresolved SearchHandler exposes FontAutoScalingEnabled; ToFont() carries it into ControlExtensions.UpdateFont, but ShellItemHandler.Windows.cs:547-550 omits it.
Shared test should not run non-Windows MauiBot inline comment 🔄 Obsolete / not accepted Current PR includes non-Windows snapshots and UI-test guidance says run all applicable platforms by default.
PlatformAffected.All was inaccurate Copilot inline comment ✅ Fixed Current HostApp page uses PlatformAffected.UWP.
Test comments/values mismatched Copilot inline comments ✅ Fixed Current test comment matches FontSize=14, Dokdo, Bold, Start.

Blast Radius Assessment

  • Runs for all instances: No, only Windows Shell pages with an effective SearchHandler.
  • Startup impact: Low; runs when Shell item handler/search box initializes.
  • Static/shared state: No new static state.

CI Status

  • Required-check result: gh pr checks --required unavailable because GitHub CLI is unauthenticated.
  • Classification: Undetermined required-check status. Public REST fallback showed current head check runs completed successfully, but required-check membership could not be verified.
  • Action taken: No comments posted; confidence capped low.

Findings

❌ Error — Runtime FontAutoScalingEnabled changes remain stale

src/Controls/src/Core/Handlers/Shell/ShellItemHandler.Windows.cs:547-550

The new runtime update cases refresh the native AutoSuggestBox for FontFamily, FontSize, and FontAttributes, but omit SearchHandler.FontAutoScalingEnabled. SearchHandler.ToFont() includes FontAutoScalingEnabled, and Windows ControlExtensions.UpdateFont() applies it via IsTextScaleFactorEnabled. Changing this bindable property at runtime will raise PropertyChanged but not update the native search box until the handler/search box is recreated. Add:

case nameof(SearchHandler.FontAutoScalingEnabled):

to the same font update group.

⚠️ Warning — iOS pre-26 snapshot baseline is missing

src/Controls/tests/TestCases.iOS.Tests/snapshots/ios-26/SearchHandlerFontPropertiesShouldBeApplied.png

The PR adds an ios-26 baseline but no corresponding snapshots/ios/ baseline. Existing SearchHandler screenshot tests generally carry both ios and ios-26 baselines, so this can fail or reduce coverage on older iOS test environments.

💡 Suggestion — Make screenshot test wait for visual stability

src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue36629.cs:22

VerifyScreenshot() is called without retryTimeout. Shell/toolbar rendering can be timing-sensitive; prefer VerifyScreenshot(retryTimeout: TimeSpan.FromSeconds(2)).

Failure-Mode Probing

  • Runtime scaling toggle: stale because FontAutoScalingEnabled is not handled in the property-change switch.
  • Handler reconnect: existing unsubscribe/resubscribe pattern avoids accumulating PropertyChanged subscriptions.
  • Null/default font values: initial attach is safe because ToFont() and IFontManager use existing MAUI font infrastructure.
  • Non-Windows UI runs: page is cross-platform and snapshots exist for Android/Mac/Windows/iOS-26, but older iOS baseline is missing.

Verdict: NEEDS_CHANGES

Confidence: low, because required CI status could not be verified via authenticated gh.
Summary: The core Windows font application approach is sound, but the new runtime font refresh path leaves one IFontElement property stale. Prior major review feedback for this issue is still valid, so this should be fixed before merge.


🛠️ Fix — Analysis & Comparison

Fix Candidates

# Source Approach Test Result Files Changed Notes
1 maui-expert-reviewer Centralize SearchHandler font invalidation in AutoSuggestBoxExtensions.IsSearchHandlerFontProperty, then update font early for all properties consumed by ToFont(), including FontAutoScalingEnabled. ✅ PASS (Issue36629, Windows UI) 2 files Better than PR fix because it fixes the stale FontAutoScalingEnabled runtime-update gap and reduces future missed-property risk. Expert self-review clean.
PR PR #36700 Apply SearchHandler font during initial Windows Shell search box hookup and on FontFamily, FontSize, and FontAttributes changes. ✅ PASSED (Gate) 2 implementation files + UI test/snapshots Original PR; gate was pre-run and passed, but pre-flight found missing FontAutoScalingEnabled runtime refresh.

Cross-Pollination

Model Round New Ideas? Details
gpt-5.5 / maui-expert-reviewer 1 Yes Centralize font-affecting property detection beside the Windows AutoSuggestBox font extension.
gpt-5.5 / maui-expert-reviewer 1 self-review No blockers Returned [] for candidate 1 final diff.

Exhausted: No — stopped early because Candidate #1 passed the targeted Windows regression and is demonstrably better than the PR fix by covering FontAutoScalingEnabled runtime updates.
Selected Fix: Candidate #1 — centralizes SearchHandler font invalidation and covers all current ToFont() inputs while preserving the PR's existing behavior.


📝 Recommended PR Title & Description

Assessment: ✏️ Recommend updating — the winning fix also covers FontAutoScalingEnabled runtime refresh and the current description has duplicate template sections plus an Issue Details list that omits VerticalTextAlignment.

Recommended title

[Windows] Shell SearchHandler: Apply font and vertical text alignment properties

Recommended description

### Issue Details
On Windows, Shell SearchHandler styling was not fully applied to the native AutoSuggestBox. FontSize, FontFamily, FontAttributes, VerticalTextAlignment, and runtime FontAutoScalingEnabled updates could be ignored or become stale.

### Description of Change
* AutoSuggestBoxExtensions.cs — Added UpdateSearchHandlerFont() to apply searchHandler.ToFont() through the platform font manager, and centralized detection of SearchHandler font-affecting properties consumed by ToFont().
* ShellItemHandler.Windows.cs — Applies SearchHandler font settings during initial AutoSuggestBox hookup and refreshes the native font when SearchHandler font properties change, including FontFamily, FontSize, FontAttributes, and FontAutoScalingEnabled. Existing VerticalTextAlignment handling continues to update the AutoSuggestBox vertical content alignment.
* Added UI coverage for issue #36629 with platform snapshots to verify the SearchHandler font and vertical text alignment rendering.

### Issues Fixed
Fixes #36629

**Tested the behavior in the following platforms.**
- [x] Android
- [x] Windows
- [x] iOS
- [x] Mac

| Before  | After  |
|---------|--------|
| **Windows**<br> <video src="https://github.com/user-attachments/assets/16b6a291-7c63-4c08-a3b1-4d4f9e601806" width="600" height="300"> | **Windows**<br> <video src="https://github.com/user-attachments/assets/a16b4533-017e-46e7-bed3-69b434becb0a" width="600" height="300"> |

🏁 Report — Final Recommendation

Comparative Analysis

Candidates

Rank Candidate Regression result Assessment
1 try-fix-1 PASS (Issue36629, Windows UI) Best candidate. It preserves the PR's initial Windows Shell SearchHandler font application, fixes the expert finding by covering FontAutoScalingEnabled, and centralizes the list of font-affecting properties beside UpdateSearchHandlerFont(). This reduces the chance of future drift when SearchHandler.ToFont() inputs change.
2 pr-plus-reviewer Not rerun; expected to preserve PR gate behavior Correctly addresses the expert reviewer's actionable issue by adding FontAutoScalingEnabled to the PR's runtime refresh switch. It is acceptable, but keeps the duplicated property list in ShellItemHandler.Windows.cs, so it is less robust than try-fix-1.
3 pr PASS (gate) The raw PR fixes the reported initial application of FontSize, FontFamily, FontAttributes, and VerticalTextAlignment, but it misses runtime FontAutoScalingEnabled refresh even though the new font helper uses SearchHandler.ToFont(). This leaves an accessibility-related font property stale after handler creation.

No STEP 5a candidate failed regression tests. Per the gate result, the raw PR passed the required regression, and STEP 5a try-fix-1 also passed the targeted Windows UI test.

Winner

Winner: try-fix-1

try-fix-1 is the strongest fix because it addresses both the original bug and the expert review finding, has targeted Windows UI pass evidence, and improves maintainability by centralizing SearchHandler font-property detection in AutoSuggestBoxExtensions. The raw PR should not win because it has an unresolved expert finding, and pr-plus-reviewer is correct but less future-proof than the centralized candidate.


🧭 Next Steps — alternative fix proposed (try-fix-1)

Automated review — alternative fix proposed

The expert-reviewer evaluation compared the PR fix against automatically generated candidates and selected try-fix-1 as the strongest fix.

Why: try-fix-1 wins because it preserves the PR's validated Windows SearchHandler font fix, addresses the expert review finding for FontAutoScalingEnabled runtime changes, and centralizes font-property detection to reduce future drift. The raw PR passed the gate but leaves a stale font-scaling path, while pr-plus-reviewer fixes that issue less maintainably.

Please consider applying the candidate diff below (or use it as guidance). Once you push an update, this workflow will re-trigger and re-evaluate.

Candidate diff (try-fix-1)
diff --git a/src/Controls/src/Core/Handlers/Shell/ShellItemHandler.Windows.cs b/src/Controls/src/Core/Handlers/Shell/ShellItemHandler.Windows.cs
index fe22429159..01de51ece3 100644
--- a/src/Controls/src/Core/Handlers/Shell/ShellItemHandler.Windows.cs
+++ b/src/Controls/src/Core/Handlers/Shell/ShellItemHandler.Windows.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
 using System.Collections.Generic;
 using System.Collections.ObjectModel;
 using System.ComponentModel;
@@ -338,6 +338,7 @@ namespace Microsoft.Maui.Controls.Handlers
 					autoSuggestBox.UpdateSearchHandlerPlaceholder(_currentSearchHandler);
 					autoSuggestBox.UpdateSearchHandlerIsEnabled(_currentSearchHandler);
 					autoSuggestBox.UpdateSearchHandlerCharacterSpacing(_currentSearchHandler);
+					autoSuggestBox.UpdateSearchHandlerFont(_currentSearchHandler, this.GetRequiredService<IFontManager>());
 					autoSuggestBox.UpdateSearchHandlerTextColor(_currentSearchHandler);
 					autoSuggestBox.UpdateSearchHandlerPlaceholderColor(_currentSearchHandler);
 					autoSuggestBox.UpdateSearchHandlerCancelButtonColor(_currentSearchHandler);
@@ -507,6 +508,12 @@ namespace Microsoft.Maui.Controls.Handlers
 				return;
 
 			var autoSuggestBox = mauiNavView.AutoSuggestBox;
+			if (AutoSuggestBoxExtensions.IsSearchHandlerFontProperty(e.PropertyName))
+			{
+				autoSuggestBox.UpdateSearchHandlerFont(_currentSearchHandler, this.GetRequiredService<IFontManager>());
+				return;
+			}
+
 			switch (e.PropertyName)
 			{
 				case nameof(SearchHandler.Query):
diff --git a/src/Controls/src/Core/Platform/Windows/Extensions/AutoSuggestBoxExtensions.cs b/src/Controls/src/Core/Platform/Windows/Extensions/AutoSuggestBoxExtensions.cs
index c9b8e40983..853fc7ae0c 100644
--- a/src/Controls/src/Core/Platform/Windows/Extensions/AutoSuggestBoxExtensions.cs
+++ b/src/Controls/src/Core/Platform/Windows/Extensions/AutoSuggestBoxExtensions.cs
@@ -24,6 +24,18 @@ namespace Microsoft.Maui.Controls.Platform
 			"TextControlBackgroundDisabled"
 		};
 
+		internal static void UpdateSearchHandlerFont(this AutoSuggestBox platformControl, SearchHandler searchHandler, IFontManager fontManager)
+		{
+			platformControl.UpdateFont(searchHandler.ToFont(), fontManager);
+		}
+
+		internal static bool IsSearchHandlerFontProperty(string? propertyName) =>
+			propertyName is null or ""
+				|| propertyName == SearchHandler.FontFamilyProperty.PropertyName
+				|| propertyName == SearchHandler.FontSizeProperty.PropertyName
+				|| propertyName == SearchHandler.FontAttributesProperty.PropertyName
+				|| propertyName == SearchHandler.FontAutoScalingEnabledProperty.PropertyName;
+
 		internal static void UpdateSearchHandlerBackground(this AutoSuggestBox platformControl, SearchHandler searchHandler)
 		{
 			UpdateColors(platformControl.Resources, backgroundColorKeys, searchHandler.BackgroundColor?.ToPlatform());

@kubaflo
kubaflo changed the base branch from main to inflight/current July 26, 2026 19:38
@kubaflo
kubaflo merged commit 1846f9f into dotnet:inflight/current Jul 26, 2026
1 of 2 checks passed
@github-actions github-actions Bot added this to the .NET 10 SR10 milestone Jul 26, 2026
kubaflo added a commit that referenced this pull request Jul 28, 2026
…nt, and FontAttributes are not applied (#36700)

<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

### Issue Details
On Windows, the following SearchHandler properties were silently
ignored: FontSize, FontFamily, and FontAttributes.
 
### Description of Changes:
* AutoSuggestBoxExtensions.cs — Added UpdateSearchHandlerFont()
extension method that delegates to UpdateFont(searchHandler.ToFont(),
fontManager).
* ShellItemHandler.Windows.cs — Called UpdateSearchHandlerFont on
initial SearchHandler attach, and added case branches for FontFamily,
FontSize, and FontAttributes in the property-changed handler.

### Description of Change

<!-- Enter description of the fix in this section -->

### Issues Fixed

<!-- Please make sure that there is a bug logged for the issue being
fixed. The bug should describe the problem and how to reproduce it. -->

Fixes #36629 

<!--
Are you targeting main? All PRs should target the main branch unless
otherwise noted.
-->

**Tested the behavior in the following platforms.**
- [x] Android
- [x] Windows
- [x] iOS
- [x] Mac

| Before  | After  |
|---------|--------|
| **Windows**<br> <video
src="https://github.com/user-attachments/assets/16b6a291-7c63-4c08-a3b1-4d4f9e601806"
width="600" height="300"> | **Windows**<br> <video
src="https://github.com/user-attachments/assets/a16b4533-017e-46e7-bed3-69b434becb0a"
width="600" height="300"> |

---------

Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com>
kubaflo added a commit that referenced this pull request Jul 29, 2026
…nt, and FontAttributes are not applied (#36700)

<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

### Issue Details
On Windows, the following SearchHandler properties were silently
ignored: FontSize, FontFamily, and FontAttributes.
 
### Description of Changes:
* AutoSuggestBoxExtensions.cs — Added UpdateSearchHandlerFont()
extension method that delegates to UpdateFont(searchHandler.ToFont(),
fontManager).
* ShellItemHandler.Windows.cs — Called UpdateSearchHandlerFont on
initial SearchHandler attach, and added case branches for FontFamily,
FontSize, and FontAttributes in the property-changed handler.

### Description of Change

<!-- Enter description of the fix in this section -->

### Issues Fixed

<!-- Please make sure that there is a bug logged for the issue being
fixed. The bug should describe the problem and how to reproduce it. -->

Fixes #36629 

<!--
Are you targeting main? All PRs should target the main branch unless
otherwise noted.
-->

**Tested the behavior in the following platforms.**
- [x] Android
- [x] Windows
- [x] iOS
- [x] Mac

| Before  | After  |
|---------|--------|
| **Windows**<br> <video
src="https://github.com/user-attachments/assets/16b6a291-7c63-4c08-a3b1-4d4f9e601806"
width="600" height="300"> | **Windows**<br> <video
src="https://github.com/user-attachments/assets/a16b4533-017e-46e7-bed3-69b434becb0a"
width="600" height="300"> |

---------

Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration platform/windows s/agent-changes-requested AI agent recommends changes - found a better alternative or issues s/agent-fix-win AI found a better alternative fix than the PR s/agent-gate-passed AI verified tests catch the bug (fail without fix, pass with fix) s/agent-reviewed PR was reviewed by AI agent workflow (full 4-phase review) shell-search-handler

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Windows] SearchHandler FontSize, FontFamily, VerticalTextAlignment, and FontAttributes are not applied

7 participants