DelegateCommand. Something like "ObservesCollection"? #2526
Unanswered
jmo-gelsight
asked this question in
WPF
Replies: 1 comment 3 replies
|
Observing |
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.ObservesPropertyall 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
ObservableCollectionalso 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.CollectionChangedmyself and manually update the command's status. Ideally, what I would like is forDelegateCommandto 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
DelegateCommandto add this but am I missing some obvious way to do this?All reactions