Maui icon indicating copy to clipboard operation
Maui copied to clipboard

[BUG] IconTintColorBehavior doesn't work as expected on Windows

Open alpayclsr1 opened this issue 1 year ago • 10 comments

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

image Icon tint color behavior works fine on Android and iOS, but when I try to use it on Windows it copies the image.

  <StackLayout
     Margin="50"
     Spacing="15"
     VerticalOptions="FillAndExpand">
     <HorizontalStackLayout>
         <Image Aspect="AspectFit" Source="png4xfolder.png">
             <Image.Behaviors>
                 <toolkit:IconTintColorBehavior TintColor="Red" />
             </Image.Behaviors>

         </Image>
         <Image Aspect="AspectFit" Source="png4xfolder.png">
             <Image.Behaviors>
                 <toolkit:IconTintColorBehavior TintColor="Blue" />
             </Image.Behaviors>

         </Image>


         <Image Aspect="AspectFit" Source="png4xfolder.png">
             <Image.Behaviors>
                 <toolkit:IconTintColorBehavior TintColor="Orange" />
             </Image.Behaviors>

         </Image>
     </HorizontalStackLayout>











 </StackLayout>

Expected Behavior

image works as expected on android

Steps To Reproduce

1.Run the application with windows and see the bug

Link to public reproduction project repository

https://github.com/alpayclsr1/BugReproductionApp.git

Environment

- .NET MAUI CommunityToolkit:
- OS:
- .NET MAUI:

Anything else?

No response

alpayclsr1 avatar Dec 07 '23 12:12 alpayclsr1

Thanks @alpayclsr1 for creating the issue and creating a sample project with the issue you are experiencing. However, could you please share the Environment details where you are facing that issue?

I'm unable to reproduce the issue with the sample project you shared with us. See screenshot below for reference: image

I'm running Windows 11 latest version image

If you are not using the latest version of Windows 11, could you please apply the latest OS updates, and test again? 😃

vhugogarcia avatar Dec 07 '23 14:12 vhugogarcia

@vhugogarcia @alpayclsr1 I am seeing this issue also, I had to put in the changes recommend in the below PR. It seems as if they have been approved but not sure when they'll actually make it into a release https://github.com/CommunityToolkit/Maui/issues/1212

SamuelJames101 avatar Dec 08 '23 15:12 SamuelJames101

Thanks @SamuelJames101 for pointing to the PR. The MCT version 5.3.0+ should contain the fix. I downloaded the sample project provided by @alpayclsr1, and I'm unable to reproduce the issue. If you could please upload a repository with the issue would be awesome.

Also, please provide the exact version of Windows 11 you are using, and if you are using a version behind the version 23H2 (OS build 22631.2792), please apply the latest Windows updates, and let us know the results. 😃

vhugogarcia avatar Dec 08 '23 20:12 vhugogarcia

@vhugogarcia The bug has been resolved because I gave a certain height. Can you download sample project again? Windows version:22H2 OS build 22621.2715

alpayclsr1 avatar Dec 11 '23 05:12 alpayclsr1

@alpayclsr1 could you close the issue if byg is resolved?

VladislavAntonyuk avatar Dec 11 '23 06:12 VladislavAntonyuk

@VladislavAntonyuk The bug continues unless we give exact height to the image. Isn't this a bug?I did not use height request in the current sample project and there is a problem.It would be better not to use height request in the scenario I will use

alpayclsr1 avatar Dec 11 '23 07:12 alpayclsr1

I see the issue if I get the image to "AspectFit" into an area.

SamuelJames101 avatar Dec 15 '23 15:12 SamuelJames101

This issue is about to get me go nuts :)

I have attached a sample project where i placed some images in a Grid which are rendered correctly. Adding the same images to a horizontal stacklayout places the tinted image on a strange offset.

When I update the code in the IconTintColorBehavior.Windows.cs file to not have an offset / anchorpoint in the visualsprite element it is rendered correctly in the stacklayout but not in the grid.

image

MauiApp4.zip

Bloodyairtimer avatar Jan 10 '24 07:01 Bloodyairtimer

Hey. I have also just ran into this issue on Windows 10. I have no idea what's going on, it was working fine and then I started using the markup toolkit and since then its duplicating the icons.

Only just starting to look into it but it does appear some weird bug is at play.

image

Note: I can confirm setting a height for some reason "fixes" the issue.

RuddyOne avatar Feb 12 '24 14:02 RuddyOne

I have the same Issue on Windows 11. For me it works when I set minimum and maximum height/width instead of a height and width request.

NoelleRousselle avatar Mar 01 '24 09:03 NoelleRousselle

@NoelleRousselle @alpayclsr1, we have been running some tests locally on Windows 11 using the MAUI Community Toolkit version 9.0.2 and .NET MAUI 8.0.70 and the issue appears to be fixed. If we don't set a height or width on the image, the tint color is applied correctly as well. Please upgrade and let us know the results.

I'm closing this issue for now. We can re-open it, if needed.

image-icon-tint

vhugogarcia avatar Jul 23 '24 15:07 vhugogarcia

@vhugogarcia It works on my side! Thank you for the update!

NoelleRousselle avatar Jul 24 '24 08:07 NoelleRousselle