Maui
Maui copied to clipboard
[BUG] Windows IconTintColorBehavior Navigate away and then back to a page and the tint is removed
Is there an existing issue for this?
- [X] I have searched the existing issues
Did you read the "Reporting a bug" section on Contributing file?
- [X] I have read the "Reporting a bug" section on Contributing file: https://github.com/CommunityToolkit/Maui/blob/main/CONTRIBUTING.md#reporting-a-bug
Current Behavior
Navigating away from a page which has an image and a tint, and then back to removes a the tint
Expected Behavior
The tint remains
Steps To Reproduce
1.Have a page with an image with a tint 2.Navigate to a second page 3.Navigate back to the first page
https://github.com/CommunityToolkit/Maui/assets/44027336/5d5634fa-cb14-4e05-bc3a-1e4bf0c2bd51
Link to public reproduction project repository
https://github.com/SamuelJames101/IconTintColourWindowsIssue
Environment
- .NET MAUI CommunityToolkit: 7.0.0
- OS: Windows 11 22H2
- .NET MAUI: Net8 GA
Anything else?
No response
Thanks @SamuelJames101 for reporting the issue. I have verified the issue.
@vhugogarcia I have created a fix in my code but I have a question, why do we remove the tint when we un-attach the behaviour? As that is where the issue lies, if we don't remove the tint but instead make sure the view (the image with the attached behaviour) only has one IconTintBehaviour at any given time then that resolved it for me.
@SamuelJames101 can you attach your workaround? @vhugogarcia is this scheduled any time soon for a fix?
Also having this issue, ETA on a fix?
@SamuelJames101 Would also like to see your workaround if possible.
I think it he fix for this is to apply a similar approach to how StatusBarBehavior works - allowing a developer to define when the behavior is applied and make the default do it in OnNavigatedTo.
I'm away for just over a week but happy to look at this when I return if there isn't any progress.
I am also running into this issue on windows. The first time the view is displayed it works fine, but navigating back to the view results in no tint. Hopefully a fix is coming in the near future.
The work around that I am using requires re-setting of the image's source in the view's Loaded event.
private IconTintColorBehavior myIconTint = new();
private void MyView_Loaded(object sender, EventArgs e)
{
if (myImage.Behaviors.Contains(myIconTint))
{
var source = myImage.Source;
myImage.Source = null;
myImage.Source = source;
}
else
{
myImage.Behaviors.Add(myIconTint);
}
}
Any progress on this? Or a way to overwrite all images to fix this for now?