-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Image Source to null doesn't work if the Source had a different value before #8787
Comments
Similar case - if MAUI fails to load the image with the new ImageSource (e.g. due to incorrect Url). It keeps showing the old image, while previously (XF or MAUI GA) it was hidden. |
Hi @AignerGames. We have added the "s/needs-repro" label to this issue, which indicates that we require steps and sample code to reproduce the issue before we can take further action. Please try to create a minimal sample project/solution or code samples which reproduce the issue, ideally as a GitHub repo that we can clone. See more details about creating repros here: https://github.com/dotnet/maui/blob/main/.github/repro.md This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time. |
Thank you so much for your bug report! Unfortunately, this report seems to be missing some details. Ideally we would love to have a minimal, reproducible example that you upload to a GitHub repository and link us to. That should greatly speed up the process, thanks! |
This project can be used to see the issue in action: |
Same problem. Very annoying. I've seen there is a PR but it was closed while the team is focusing on something else. |
Leaving a comment to also state that I've come across this issue. You would expect setting an ImageSource to 'null' would remove the image. |
Also seeing this problem. We use it to display various error states, so obviously it very important for us to be able to clear the state when fixed. |
I'm facing this problem too and it seems like this bug will remain for a while so I made a workaround for now. I created a custom handler for Handler:
Image Extension:
ImageSourcePartLoader extension:
Register the handler in MauiProgram:
|
Any update on this please? |
My workaround for now has been to use a transparent image. Instead of setting ImageSource to null, replace with the name of the transparent image. |
If the image source fails (e.g. invalid url or no internet), the previous image source will remain (that's if you're changing the image source from one to another). This is especially evident when using a |
* Blank image when Source set to null or on image loading error Fixes #8787 * Auto-format source code * Null check cleanup * Fix test --------- Co-authored-by: GitHub Actions Autoformatter <[email protected]>
#13989) * Blank image when Source set to null or on image loading error Fixes #8787 * Auto-format source code * Null check cleanup * Fix test --------- Co-authored-by: E.Z. Hart <[email protected]> Co-authored-by: GitHub Actions Autoformatter <[email protected]>
…image loading error (#14071) * Blank image when Source set to null or on image loading error Fixes #8787 * Auto-format source code * Null check cleanup * Fix test --------- Co-authored-by: E.Z. Hart <[email protected]> Co-authored-by: GitHub Actions Autoformatter <[email protected]>
Description
I have a Image and the Source property is bound to a ImageSource property of my ViewModel class.
I have a button to take a image and then update the ImageSource (including PropertyChanged etc).
This works so far, the Image updates after I take a new image.
I added a delete button to delete the image and set my ImageSource property to null (including Propertychanged call etc.)
But I noticed that the Image doesn't change back to null / blank, the old image is still shown, no matter how often I set it to null or invoke the PropertyChanged event
I even tried to take a direct reference to the Image in my View code and noticed that even setting the property directly to null by code doesn't reset the image.
So there is no way to reset the Image source after a "real" image was shown.
Steps to Reproduce
1, Add a Image and set a "real" Image Source (Image should be visible)
2, Change the Image Source to null by code or binding (for example with a button click handler)
3, Confirm that the Image Source is null -> Old Image is still shown, even after the Source was set to null
Version with bug
6.0.408 (current)
Last version that worked well
Unknown/Other
Affected platforms
Android, Windows
Affected platform versions
Windows 10
Did you find any workaround?
Hide the image with a IsVisible Binding
Relevant log output
No response
The text was updated successfully, but these errors were encountered: