Skip to content
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

[Bug] [V1.3] SfTextInputLayout does not update its color when changing theme sometimes #130

Open
malsabi opened this issue Mar 16, 2025 · 4 comments
Assignees
Labels
s/needs-repro text-input-layout Text Input Layout control

Comments

@malsabi
Copy link

malsabi commented Mar 16, 2025

Description

Here is an example of my xaml snippet for using the SfTextInputLayout. I'm not sure if the issue is from my side or not, but sometimes the color works properly when changing the theme but sometimes the color is not updated. I can see this issue in Windows, iOS and android.

<inputLayout:SfTextInputLayout Grid.Row="0"
                                 Hint="{ext:Translate Name=Assessments_SearchPlaceHolder}"
                                 IsEnabled="{Binding IsBusy, Converter={StaticResource InvertedBoolConverter}}"
                                 Style="{StaticResource TextInputLayoutStyle}">
<inputLayout:SfTextInputLayout.LeadingView>
<Image Aspect="Center"
                 Source="{StaticResource SearchIcon}" />
</inputLayout:SfTextInputLayout.LeadingView>
 
      <Entry Text="{Binding SearchTextQuery}"
             Style="{StaticResource TextInputEntryStyle}">
<Entry.Behaviors>
<toolkit:EventToCommandBehavior EventName="TextChanged"
                                              Command="{Binding SearchTextQueryChangedCommand, x:DataType=viewModels:AssessmentsViewModel}"
                                              BindingContext="{Binding BindingContext, Source={x:Reference Root}, x:DataType=ContentPage}" />
</Entry.Behaviors>
</Entry>
 
      <VisualStateManager.VisualStateGroups>
<VisualStateGroupList>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal" />
<VisualState x:Name="PointerOver">
<VisualState.Setters>
<Setter Property="ContainerBackground" Value="{toolkit:AppThemeResource Shade3Color}" />
</VisualState.Setters>
</VisualState>
<VisualState x:Name="Disabled">
<VisualState.Setters>
<Setter Property="ContainerBackground" Value="{toolkit:AppThemeResource Shade4Color}" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateGroupList>
</VisualStateManager.VisualStateGroups>
</inputLayout:SfTextInputLayout>

Steps to Reproduce

No response

Version with bug

1.0.3

Is this a regression from previous behavior?

No, this is a new issue

Last Known Working Version

1.0.2

Affected platforms

Windows

Affected Platform Versions

No response

Have you found a workaround?

No workaround

Relevant log output

@Choza-rajan
Copy link
Collaborator

Choza-rajan commented Mar 18, 2025

@malsabi We have reviewed the reported issue using the provided code snippet. However, we were unable to reproduce the issue "SfTextInputLayout does not update its color when changing theme sometimes" with .NET 9 and MAUI v9.0.50. The SfTextInputLayout responds to the theme switch properly in our testing.

To assist you further, we have attached our tested sample and an output video for your reference. Kindly test the attached sample and let us know if you encounter the issue in the sample.

If the issue still persists on your end, please share more details to help us better understand the problem. Specifically, it would be helpful if you could provide:

  1. The exact .NET and MAUI versions you are using.
  2. Any custom styles or configurations applied to the SfTextInputLayout.
  3. How you are switching themes and its configurations.
  4. A simple reproducible sample that demonstrates the issue.

This will allow us to investigate further and provide a more precise solution. Looking forward to your response

TextInputLayoutSample.zip

@Choza-rajan Choza-rajan self-assigned this Mar 18, 2025
@Choza-rajan Choza-rajan added bug Something isn't working text-input-layout Text Input Layout control and removed bug Something isn't working labels Mar 18, 2025
@malsabi
Copy link
Author

malsabi commented Mar 20, 2025

I'm sorry, I forgot to mention this extra step. However, I couldn't replicate the issue in a small repository. It still occurs in my main app, but I can't share it here for privacy reasons.

Steps to Reproduce:

  1. Open the Home Page, which displays the SfTextInputLayout.

  2. Navigate to the Details Page.

  3. Navigate back to the Home Page, then switch between Light and Dark themes.

Observed Issue:

  • The text color and icon color of the LeadingView do not update.

  • Only the container color updates correctly.

Additional Note:

  • If I don't navigate to any other page and simply switch between Light and Dark themes, everything works as expected.
  • The issue only occurs after navigating to the Details Page and then returning to the Home Page before changing the theme.
  • If the issue has already occurred and I change the theme from Light to Dark, the text color remains black instead of updating to white. However, if I navigate to another page and return, the text color updates correctly.

@Choza-rajan
Copy link
Collaborator

Hi @malsabi ,

Thank you for your update and for providing the detailed steps to reproduce the issue.

We have tested the mentioned scenario by creating a new Details Page, adding a Label and an Icon, and setting their colors dynamically based on the Light and Dark themes.

During our testing, the text color and icon color of the LeadingView were correctly updated along with the container color. Additionally, we tested by placing SfTextInputLayout inside the Details Page, and the colors updated properly as expected.

For your reference, we have attached the tested sample. Kindly check it and let us know if the issue still persists on your end. If so, please share the XAML code of the page where SfTextInputLayout is implemented, along with the relevant ViewModel and any other necessary code snippets. This will help us investigate the issue more precisely and provide you with an appropriate solution.

TextInputLayoutSample.zip

Thanks,

@malsabi
Copy link
Author

malsabi commented Mar 28, 2025

@Choza-rajan Thank you for your reply. I found out that the bug happens only when the "Details page" is implementing similar implementation of the SfTextInputLayout. So when you navigate back to the Main page you will see that the bug is happening and the colors are not updating.

I have made a video and I updated the source code.
If there is a workaround please let me know.

TextInputLayoutSample.zip

inputlayout_issue.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
s/needs-repro text-input-layout Text Input Layout control
Projects
None yet
Development

No branches or pull requests

3 participants