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

WPF losts the binding after some operation #9349

Open
vsfeedback opened this issue Jul 4, 2024 · 1 comment
Open

WPF losts the binding after some operation #9349

vsfeedback opened this issue Jul 4, 2024 · 1 comment
Labels
📭 waiting-author-feedback To request more information from author.

Comments

@vsfeedback
Copy link

This issue has been moved from a ticket on Developer Community.


[severity:It's more difficult to complete my work]
Good morning,

I have encountered a problem and I can't seem to resolve it. I have tried everything but cannot bypass the issue. I have attached a video to show what happens.

To reproduce the error:

Open the XML file (you will find it in the attachments).
Select either line 1 or line 2 as many times as you want, and everything works.
Change the key, the first field in the top left corner.
Select the lines again, and you will notice that the selection no longer has any effect, and that an exception occurs after returning to a previously selected line.
If you click the "test" button in the toolbar, the error does not occur. This error is generated by the listview.

Thank you.
Attached there is also the solution and the
LocalizzatoreRisorse.zip
Stringhe it-IT - Copia.xaml
15-50-19.mp4


Original Comments

Feedback Bot on 6/25/2024, 07:48 AM:

(private comment, text removed)


Original Solutions

(no solutions)

@miloush
Copy link
Contributor

miloush commented Jul 4, 2024

That's because you change the hash code of the items in the collection (StringaProgetto). You cannot do that, the list view then cannot find the item to be removed from selection when you change selection. Remove the GetHashCode override and it starts working (also note that you should not base equality on the equality of hash codes, they can be equal when the strings are not).

Refer to the notes on GetHashCode(): https://learn.microsoft.com/en-us/dotnet/api/system.object.gethashcode

@harshit7962 harshit7962 added the 📭 waiting-author-feedback To request more information from author. label Jul 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📭 waiting-author-feedback To request more information from author.
Projects
None yet
Development

No branches or pull requests

3 participants