Skip to content

Commit ad506dc

Browse files
[Android][Regression] Fixed Entry and Editor AppThemeBinding colors for text and placeholder reset to default on theme change (#31891)
* added snapshots and fix * removed test cases * added the test cases and snapshots * added braces * added mac and windows snapshots * added mac and windows snapshots * added snapshot
1 parent 1e56eca commit ad506dc

20 files changed

+135
-2
lines changed
Loading
Loading
26 KB
Loading
27.1 KB
Loading
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
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+
xmlns:local="clr-namespace:Maui.Controls.Sample"
5+
x:Class="Maui.Controls.Sample.Issues.Issue31889">
6+
<VerticalStackLayout Spacing="20"
7+
HorizontalOptions="Center">
8+
<HorizontalStackLayout>
9+
<Label Text="Entry: "
10+
VerticalOptions="Center"
11+
TextColor="{AppThemeBinding Light=Black, Dark=White}"/>
12+
<local:UITestEntry AutomationId="TestEntry"
13+
IsCursorVisible="False"
14+
IsSpellCheckEnabled="False"
15+
Placeholder="Entry Placeholder"
16+
PlaceholderColor="{AppThemeBinding Light=Green, Dark=Orange}"
17+
Text="Entry Text"
18+
TextColor="{AppThemeBinding Light=Blue, Dark=Red}"
19+
WidthRequest="200"/>
20+
</HorizontalStackLayout>
21+
<HorizontalStackLayout>
22+
<Label Text="Editor: "
23+
TextColor="{AppThemeBinding Light=Black, Dark=White}"
24+
VerticalOptions="Center"/>
25+
<local:UITestEditor AutomationId="TestEditor"
26+
IsCursorVisible="False"
27+
IsSpellCheckEnabled="False"
28+
Placeholder="Editor Placeholder"
29+
PlaceholderColor="{AppThemeBinding Light=Green, Dark=Orange}"
30+
Text="Editor Text"
31+
TextColor="{AppThemeBinding Light=Blue, Dark=Red}"
32+
WidthRequest="200"/>
33+
</HorizontalStackLayout>
34+
<HorizontalStackLayout Spacing="10"
35+
HorizontalOptions="Center">
36+
<Button AutomationId="LightThemeButton"
37+
Text="Light Theme"
38+
Clicked="OnLightThemeButtonClicked"
39+
HorizontalOptions="Center"/>
40+
<Button AutomationId="DarkThemeButton"
41+
Text="Dark Theme"
42+
Clicked="OnDarkThemeButtonClicked"
43+
HorizontalOptions="Center"/>
44+
</HorizontalStackLayout>
45+
</VerticalStackLayout>
46+
</ContentPage>
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
namespace Maui.Controls.Sample.Issues;
2+
3+
[Issue(IssueTracker.Github, 31889, "Entry and Editor AppThemeBinding colors for text and placeholder reset to default on theme change", PlatformAffected.Android)]
4+
public partial class Issue31889 : ContentPage
5+
{
6+
public Issue31889()
7+
{
8+
InitializeComponent();
9+
this.SetAppThemeColor(BackgroundColorProperty, Colors.White, Colors.Black);
10+
}
11+
public void OnLightThemeButtonClicked(object sender, EventArgs e)
12+
{
13+
if (Application.Current is not null)
14+
{
15+
Application.Current.UserAppTheme = AppTheme.Light;
16+
}
17+
}
18+
19+
public void OnDarkThemeButtonClicked(object sender, EventArgs e)
20+
{
21+
if (Application.Current is not null)
22+
{
23+
Application.Current.UserAppTheme = AppTheme.Dark;
24+
}
25+
}
26+
}
13.6 KB
Loading
14.5 KB
Loading
11.4 KB
Loading
11.6 KB
Loading

0 commit comments

Comments
 (0)