❔ WPF Binding to collection in static instance not updating list
I have a collection in a static member of a class that's being changed. It should be firing
PropertyChanged
for the property shown below. But the list never updates.
The original plan was to declare it in the XAML, but I haven't figured out the equivalent syntax. Can someone tell me what I'm doing wrong? I tried both NotifyOnTargetUpdated
as shown above and NotifyOnSourceUpdated
. My orignal impression was the latter is for when the control needs to be notified the source has changed. But after reading the documentation, it looks like it's the other way around. With Data.NetworkMgr.mgr
, Data
is a namespace, NetworkMgr
is a class, and mgr
is the static instance of Data.NetworkMgr
.4 Replies
lets get the general stuff cleared first
-why are you doing the binding in codebehind?
-is mgr a list?
-if its a list does it implement Inotifycollectionschanged?
-does the class itself implement inotifypropertychanged
-are you invoking onpropertychanged
-maybe typo in propertyname?
-is the "static instance" even a property?
@Will Pittenger also some more code would help.. if its on github on so a link would be beneficial
there is too much to guess from just your snippet
The class does implement
INotifyPropertyChanged
. I mentioned PropertyChanged
. As for the collection, after I left last night, I realized the collection is the Values
property a System.Collections.Generic.SortedDictionary
expansion. Would that cause problems.
Not yet, but I can make it one.
I am firing PropertyChanged
. And I checked the property name several times.
No code on GitHub.
The declaration chain with some extra stuff removed:
Got to go.
Be back later.
@ACiDCA7 So is there a collection option that might not have issues? The code I have now, still what's above, throws an exception in the dictionary's ValueCollection
enumerator because the contents changed.I did just create a repository on GitHub for it. https://github.com/ChatZilla-Replacement-Project/Best-Chat
GitHub
GitHub - ChatZilla-Replacement-Project/Best-Chat: This is a mockup ...
This is a mockup done in C# and WPF. Some functionality is present. - GitHub - ChatZilla-Replacement-Project/Best-Chat: This is a mockup done in C# and WPF. Some functionality is present.
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.