DelegateCommand. Something like "ObservesCollection"? #2526
Unanswered
jmo-gelsight
asked this question in
WPF
Replies: 1 comment 3 replies
-
Observing |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I use
DelegateCommand.ObservesProperty
all the time. But I have a case where I wish there was something different. I'm wondering if there is but I just have missed it.It happens when my view-models expose a command whose enabled status depends upon the content of an
ObservableCollection
also exposed by the same viewmodel. Some times these commands are only enabled when a certain number of items are in the collection. Others, only when a certain types of items are in it.My typical workaround is to subscribe to
INotifyCollectionChanged.CollectionChanged
myself and manually update the command's status. Ideally, what I would like is forDelegateCommand
to have a function calledObservesCollection()
that would trigger a check whenever the collection in question sent out aCollectionChanged
.I was about to try to derive my own class from
DelegateCommand
to add this but am I missing some obvious way to do this?Beta Was this translation helpful? Give feedback.
All reactions