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] IconTintColorBehavior is reset when navigate to another page then back #1957

Open
2 tasks done
zenith6495 opened this issue Jun 20, 2024 · 15 comments · May be fixed by #2077 or #2304
Open
2 tasks done

[BUG] IconTintColorBehavior is reset when navigate to another page then back #1957

zenith6495 opened this issue Jun 20, 2024 · 15 comments · May be fixed by #2077 or #2304
Labels
area/behaviors Issue/Discussion/PR that has to do with Behaviors bug Something isn't working unverified

Comments

@zenith6495
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Did you read the "Reporting a bug" section on Contributing file?

Current Behavior

IconTintColorBehavior for image is reset to black color when you navigate to another page then back to current page.

Expected Behavior

IconTintColorBehavior for image should remain the same when navigate to another page then to the current page.

Steps To Reproduce

  1. Set IconTintColorBehavior of an Image to red color for example.
  2. Navigate to another page using Shell.GotoAsync.
  3. Go back to the previous page, where icon is tinted to red.
  4. Notice the tinted image is reset back to black color.

Note: I noticed this issue in the latest version community toolkit sample project as well.

Link to public reproduction project repository

https://github.com/CommunityToolkit/Maui/tree/main/samples

Environment

- .NET MAUI CommunityToolkit: 9.0.1
- OS: Windows
- .NET MAUI: 8.0.60

Anything else?

No response

@zenith6495 zenith6495 added bug Something isn't working unverified labels Jun 20, 2024
@vhugogarcia vhugogarcia added the area/behaviors Issue/Discussion/PR that has to do with Behaviors label Jun 20, 2024
@kkppstudios
Copy link

Thanks for logging this. I'm experiencing the same issue. Also seeing the tint color reset to white after a DataTrigger changes the tint color and then changes it back.

@TheSundayDev
Copy link

TheSundayDev commented Jul 9, 2024

Thanks for this. I'm experiencing the same issue on IOS even when the app goes background and then comes back.

@myix765 myix765 linked a pull request Jul 31, 2024 that will close this issue
6 tasks
@TheSundayDev
Copy link

Hi all, just to know. this issue is also on IOS. The fix above is also for IOS?
thanks a lot

@Saurbaum
Copy link

I've noticed that by forcing a property change on the control that the image button has the behavior on will cause it to reevaluate it. Sadly this work around doesn't work if the Image buttons are in a collection.

@TheSundayDev
Copy link

Hi,
it seems that the issue is partially solved from last version of CT (9.0.2). Now when I go to a new page the color is alwasy applied. The only issue I can still see is that when I come back to prev page, if you are using behavior in list view items, the color is wrong in some elements (eg instead to be applied to 2nd element is applied to the first.. ).

@elTRexx
Copy link

elTRexx commented Oct 26, 2024

I have similar issue with a Button with an ImageSource and a IconTintColorBehavior applied. My image is an SVG (using its automatically created PNG clone in XAML definition). Going to another page and then back (using built-in back navigation button) didn't apply the custom tint of my image button. I'm using 9.1.0 version of the Toolkit, using Windows Machine. It worked though on android emulator.

@TheSundayDev
Copy link

Hi,
the bug is still open and it's the same of ths issue #2275
IconTintColorBehavior is my nightmare and it's blocking me to migrate to MAUI :(

@bijington
Copy link
Contributor

@TheSundayDev can you please try testing the result of this PR: #2304 and add in the ApplyOn property to your behavior usage? Set it to OnViewLoaded.

@TheSundayDev
Copy link

TheSundayDev commented Oct 27, 2024

@TheSundayDev can you please try testing the result of this PR: #2304 and add in the ApplyOn property to your behavior usage? Set it to OnViewLoaded.

Hi,
thanks a lot for your commitment, much appreciated! I'm going to test asap.
Just one question, since there is an issue I think that that fix should be apply by default and not setting a parameter. Am I wrong?

@bijington
Copy link
Contributor

I get your point but that would be a behavioral change. We haven't had many people report this issue so either they aren't seeing it or aren't using the behavior. If it's a common issue then it would be wise to change the default behavior

@TheSundayDev
Copy link

Thanks a lot for your super quick answer, thanks!
Can you tell me how to test your PR?
thanks

@bijington
Copy link
Contributor

@TheSundayDev you can follow this page to pull down the build from the PR: https://github.com/CommunityToolkit/Maui/wiki/Preview-Packages

@TheSundayDev
Copy link

hi,
in order to test all test must be passed?
thanks

@TheSundayDev
Copy link

Hi, no news for this PR?
thanks

@bijington
Copy link
Contributor

We have some pipeline failures which I haven't worked out the cause yet. You can probably still grab the preview build though

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/behaviors Issue/Discussion/PR that has to do with Behaviors bug Something isn't working unverified
Projects
None yet
7 participants