Skip to content

Commit fe94ace

Browse files
kubafloanandhan-rajagopal
authored andcommitted
[Android] Custom back button image color (dotnet#24993)
* [Android] Custom back button image color * Added snapshots and excluded Windows form tests * Update CustomBackButtonShouldBeRed.png
1 parent d5cd079 commit fe94ace

File tree

6 files changed

+66
-0
lines changed

6 files changed

+66
-0
lines changed

src/Controls/src/Core/Compatibility/Handlers/Shell/Android/ShellToolbarAppearanceTracker.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ protected virtual void SetColors(AToolbar toolbar, IShellToolbarTracker toolbarT
4545
shellToolbar.BarTextColor = title ?? ShellRenderer.DefaultTitleColor;
4646
shellToolbar.BarBackground = new SolidColorBrush(background ?? ShellRenderer.DefaultBackgroundColor);
4747
shellToolbar.IconColor = foreground ?? ShellRenderer.DefaultForegroundColor;
48+
toolbarTracker.TintColor = foreground ?? ShellRenderer.DefaultForegroundColor;
4849
}
4950

5051
#region IDisposable
11 KB
Loading
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
4+
x:Class="Maui.Controls.Sample.Issues.Issue17228"
5+
Shell.ForegroundColor="Red"
6+
Shell.BackgroundColor="HotPink"
7+
xmlns:ns="clr-namespace:Maui.Controls.Sample.Issues">
8+
<Shell.BackButtonBehavior>
9+
<BackButtonBehavior
10+
IconOverride="groceries.png"/>
11+
</Shell.BackButtonBehavior>
12+
<VerticalStackLayout>
13+
<Label
14+
Text="Welcome to .NET MAUI!"
15+
AutomationId="label"/>
16+
</VerticalStackLayout>
17+
</ContentPage>
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
namespace Maui.Controls.Sample.Issues
2+
{
3+
[Issue(IssueTracker.Github, 17228, "Back button image color can't be changed", PlatformAffected.Android)]
4+
public class Issue17228Shell : Shell
5+
{
6+
public Issue17228Shell()
7+
{
8+
Routing.RegisterRoute(nameof(Issue17228), typeof(Issue17228));
9+
Items.Add(new ShellContent()
10+
{
11+
Content = new ContentPage() { Title = "Home page" }
12+
});
13+
GoToAsync(nameof(Issue17228));
14+
}
15+
}
16+
17+
public partial class Issue17228 : ContentPage
18+
{
19+
public Issue17228()
20+
{
21+
InitializeComponent();
22+
}
23+
}
24+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#if ANDROID || IOS
2+
using NUnit.Framework;
3+
using UITest.Appium;
4+
using UITest.Core;
5+
6+
namespace Microsoft.Maui.TestCases.Tests.Issues;
7+
8+
public class Issue17228 : _IssuesUITest
9+
{
10+
public Issue17228(TestDevice testDevice) : base(testDevice)
11+
{
12+
}
13+
14+
public override string Issue => "Back button image color can't be changed";
15+
16+
[Test]
17+
[Category(UITestCategories.Shell)]
18+
public void CustomBackButtonShouldBeRed()
19+
{
20+
App.WaitForElement("label");
21+
VerifyScreenshot();
22+
}
23+
}
24+
#endif
24.3 KB
Loading

0 commit comments

Comments
 (0)