-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[iOS] [Android] Fix for the FontImageSource color is not applied properly to the Tab Icon #26757
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
Merged
PureWeen
merged 9 commits into
dotnet:inflight/current
from
Tamilarasan-Paranthaman:fix-26662
Mar 19, 2025
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
b2d6ea7
Tab icon color fix
Tamilarasan-Paranthaman 3134b87
Test sample changes
Tamilarasan-Paranthaman b43ecf3
Added snapshots
Tamilarasan-Paranthaman 15aa188
Added details
Tamilarasan-Paranthaman 29c51ba
Added Mac snapshots
Tamilarasan-Paranthaman a1d82ed
Removed unwanted parameters and modified the test sample
Ahamed-Ali 08bef64
Committed the proper mac snap
Ahamed-Ali 8731107
Removed the unwanted issue list comments
Ahamed-Ali 7f14050
Addressed the review concerns
Ahamed-Ali File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Binary file added
BIN
+26.8 KB
...oid.Tests/snapshots/android/DynamicFontImageSourceColorShouldApplyOnTabIcon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+27.2 KB
...es.Android.Tests/snapshots/android/FontImageSourceColorShouldApplyOnTabIcon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions
14
src/Controls/tests/TestCases.HostApp/Issues/Issue26662.xaml
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| <?xml version="1.0" encoding="utf-8" ?> | ||
| <TabbedPage | ||
| xmlns="http://schemas.microsoft.com/dotnet/2021/maui" | ||
| xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||
| SelectedTabColor="Green" | ||
| UnselectedTabColor="gray" | ||
| xmlns:local="clr-namespace:Maui.Controls.Sample.Issues" | ||
| x:Class="Maui.Controls.Sample.Issues.Issue26662"> | ||
|
|
||
| <local:Issue26662Tab1/> | ||
| <local:Issue26662Tab2/> | ||
| <local:Issue26662Tab3/> | ||
|
|
||
| </TabbedPage> |
112 changes: 112 additions & 0 deletions
112
src/Controls/tests/TestCases.HostApp/Issues/Issue26662.xaml.cs
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,112 @@ | ||
| namespace Maui.Controls.Sample.Issues | ||
| { | ||
| [Issue(IssueTracker.Github, 26662, "Unable to dynamically set unselected IconImageSource Color on Android", PlatformAffected.All)] | ||
| public partial class Issue26662 : TabbedPage | ||
| { | ||
| public Issue26662() | ||
| { | ||
| InitializeComponent(); | ||
| } | ||
|
|
||
| } | ||
|
|
||
| public class Issue26662Tab1 : ContentPage | ||
| { | ||
| public Issue26662Tab1() | ||
| { | ||
| //If no FontImageSource color is given, tab icon should be applied based on the SelectedTabColor and UnselectedTabColor. | ||
| IconImageSource = new FontImageSource | ||
| { | ||
| FontFamily = "Ion", | ||
| Glyph = "\uf30c", | ||
| Size = 15 | ||
| }; | ||
| Button button = new Button | ||
| { | ||
| Text = "Change Icon Color", | ||
| BackgroundColor = Colors.Blue, | ||
| TextColor = Colors.Red | ||
| }; | ||
| button.AutomationId = "Button"; | ||
| button.Clicked += (s, e) => | ||
| { | ||
| //If the FontImageSource color is given, the tab icon color should be applied solely based on the specified color, regardless of the SelectedTabColor or UnselectedTabColor. | ||
| (this.IconImageSource as FontImageSource).Color = Colors.Violet; | ||
| }; | ||
| Title = "Tab 1"; | ||
| var verticalStackLayout = new VerticalStackLayout | ||
| { | ||
| VerticalOptions = LayoutOptions.Center, | ||
| Children = { | ||
| new Label | ||
| { | ||
| HorizontalOptions = LayoutOptions.Center, | ||
| Text = "Tab 1" | ||
| }, | ||
| button | ||
| } | ||
|
|
||
| }; | ||
| Content = verticalStackLayout; | ||
| } | ||
| } | ||
|
|
||
| public class Issue26662Tab2 : ContentPage | ||
| { | ||
| public Issue26662Tab2() | ||
| { | ||
| //The FontImageSource color is given. So, the tab icon color should be applied based solely on the given color, regardless of the selected tab or unselected tab color. | ||
| IconImageSource = new FontImageSource | ||
| { | ||
| FontFamily = "Ion", | ||
| Glyph = "\uf30c", | ||
| Color = Colors.DodgerBlue, | ||
| Size = 15 | ||
| }; | ||
|
|
||
| Title = "Tab 2"; | ||
| var verticalStackLayout = new VerticalStackLayout | ||
| { | ||
| VerticalOptions = LayoutOptions.Center, | ||
| Children = | ||
| { | ||
| new Label | ||
| { | ||
| HorizontalOptions = LayoutOptions.Center, | ||
| Text = "Tab 2" | ||
| }, | ||
| } | ||
| }; | ||
| Content = verticalStackLayout; | ||
| } | ||
| } | ||
| public class Issue26662Tab3 : ContentPage | ||
| { | ||
| public Issue26662Tab3() | ||
| { | ||
| //The FontImageSource color is given. So, the icon color should be applied based solely on the given color, regardless of the selected tab or unselected tab color. | ||
| IconImageSource = new FontImageSource | ||
| { | ||
| FontFamily = "Ion", | ||
| Glyph = "\uf30c", | ||
| Color = Colors.Red, | ||
| Size = 15 | ||
| }; | ||
|
|
||
| Title = "Tab 3"; | ||
| var verticalStackLayout = new VerticalStackLayout | ||
| { | ||
| VerticalOptions = LayoutOptions.Center, | ||
| Children = | ||
| { | ||
| new Label | ||
| { | ||
| HorizontalOptions = LayoutOptions.Center, | ||
| Text = "Tab 3" | ||
| }, | ||
| } | ||
| }; | ||
| Content = verticalStackLayout; | ||
| } | ||
| } | ||
| } |
Binary file added
BIN
+11.5 KB
...ses.Mac.Tests/snapshots/mac/DynamicFontImageSourceColorShouldApplyOnTabIcon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+11.7 KB
.../TestCases.Mac.Tests/snapshots/mac/FontImageSourceColorShouldApplyOnTabIcon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.