Skip to content

[Windows] Fixed : Switch control default width issue #30538

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Tamilarasan-Paranthaman
Copy link
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!

Root Cause of the issue

  • The native WinUI ToggleSwitch control defines a default MinWidth of 154 in its style, likely to accommodate the OnContent and OffContent values supported in WinUI. However, since .NET MAUI does not support displaying these contents, the default minimum width is unnecessary. As a result, the control always reserves that space, leading to unnecessary space usage in .NET MAUI.

Description of Change

  • The native ToggleSwitch's minimum width is now set based on the MinimumWidthRequest value provided by the MAUI Switch view. Since MAUI does not support OnContent and OffContent, the default width is unnecessary. This change ensures the control's width reflects the actual layout requirement, resolving the unwanted spacing issue.

Reference

Issues Fixed

Fixes #28901
Fixes #30273

Tested the behaviour in the following platforms

  • iOS
  • Mac
  • Android
  • Windows

Screenshot

Before Fix After Fix
Before-Fix.mp4
After-Fix.mp4

@dotnet-policy-service dotnet-policy-service bot added the community ✨ Community Contribution label Jul 10, 2025
Copy link
Contributor

Hey there @@Tamilarasan-Paranthaman! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@dotnet-policy-service dotnet-policy-service bot added the partner/syncfusion Issues / PR's with Syncfusion collaboration label Jul 10, 2025
@bronteq
Copy link

bronteq commented Jul 10, 2025

This is an old bug, thanks to finally address it!
See also this #10107
@sheiksyedm

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Windows] Switch HorizontalOptions="End" not working Switch control shows a big end margin.
2 participants