Binding doesn't update for some reason
Hey, i'm having some wierd issues with binding not updating in wpf, here's the relevant code:
(the issue is that the item count in the player inventory doesn't update on display)
TradeView.xaml (lines 23-48)
TradeViewViewModel (lines 49-59)
PlayerViewModel
InventoryViewModel
ItemViewModel
ViewModelBase
21 Replies
You are updating the collection by the indexer
which I don't believe is tracked by the binding engine
so call
OnPropertyChanged
explicitly after performing your updateCan I see your
GameView.xaml
?From what I can tell you're not calling OnPropertyChanged when the value updates
it does update tho, and im calling it
Your model does not implement INotifyPropertyChanged
code:
output:
it does
Looking at it, can't see that it does.
model
??
not viewmodel
the model shouldn't integrate inotify, it's against mvvm
this is all the relevant code
Now why would that be
coz a model is for static stuff
i have both model and viewmodel couterparts
for everything
Implementing INPC in a model that holds states is absolutely not against MVVM
what model do you want tho, i dont understand
like what doesnt that have to do with the binding
You're trying to update a property of Player
I think you'd do yourself a massive favour if you get rid of all the manual INPC invokation and download a package like CommunityToolkit that does it for you
ill try it ig
did it, still doesnt work viewmodels
@FusedQyou ?
i tried even coding it from scratch with the toolkit in mind, still nothing