Fixed improper rendering of ThumbimageSource in Slider#34064
Open
NirmalKumarYuvaraj wants to merge 18 commits intodotnet:mainfrom
Open
Fixed improper rendering of ThumbimageSource in Slider#34064NirmalKumarYuvaraj wants to merge 18 commits intodotnet:mainfrom
NirmalKumarYuvaraj wants to merge 18 commits intodotnet:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates MAUI Slider thumb image handling to avoid oversized custom thumb images (primarily on Android, and also iOS/macOS), and adds an Issue test case + updated snapshot baselines to validate the visual behavior.
Changes:
- Android: scale custom thumb drawables to a target dp size before applying to
SeekBar. - iOS: resize custom thumb images to match the platform default thumb size derived from
UISlidergeometry. - Tests: add Issue13258 UI test page + UITest, and update/add snapshot baselines impacted by the change.
Reviewed changes
Copilot reviewed 4 out of 10 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/Core/src/Platform/Android/SliderExtensions.cs | Adds thumb scaling logic and refactors default-thumb restoration/tint behavior. |
| src/Core/src/Platform/iOS/SliderExtensions.cs | Resizes thumb images to the slider’s default thumb size; minor null-check refactors. |
| src/Controls/tests/TestCases.HostApp/Issues/Issue13258.cs | New HostApp reproduction page for thumb image sizing + runtime changes. |
| src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue13258.cs | New screenshot-based UITest for Issue13258. |
| src/Controls/tests/TestCases.Android.Tests/snapshots/android/SliderShouldChangeThumbImageAndResetIt.png | Updated/added Android snapshot baseline impacted by thumb sizing changes. |
| src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/SliderShouldChangeThumbImageAndResetIt.png | Updated/added iOS snapshot baseline impacted by thumb sizing changes. |
| src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/SliderThumbImageShouldBeScaled.png | Adds Mac snapshot baseline for the new Issue13258 test method. |
| src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/SliderShouldChangeThumbImageAndResetIt.png | Updated/added Mac snapshot baseline impacted by thumb sizing changes. |
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of Change
This pull request addresses the issue of oversized slider thumb images on Android, iOS, and macOS by ensuring that custom thumb images are properly scaled to match platform guidelines. It introduces platform-specific logic to resize thumb images and adds a test case to validate the fix. Additionally, it includes minor code improvements for null checking and code clarity.
Platform-specific slider thumb image scaling:
SliderExtensions.cs) [1] [2] [3]UISliderusing the slider's track and thumb rects. This ensures consistent appearance with native controls. (SliderExtensions.cs) [1] [2] [3]Test coverage:
Issue13258.csin bothTestCases.HostAppandTestCases.Shared.Tests) [1] [2]Code quality improvements:
!= nullchecks withis not nullfor clarity and consistency. (SliderExtensions.csfor both Android and iOS) [1] [2] [3]These changes ensure that slider thumb images are visually consistent across platforms and address the reported issue with minimal impact on existing functionality.
Issues Fixed
Fixes #13258
Previously closed PR - #27472