You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How would I use an async function to update a "CanExecute" property of a RelayCommand?
The docs say a method can be used, but unfortunately an async Task method gives a build error of
"The CanExecute name must refer to a compatible member, but no valid members were found for "CanUpdate" in type foo"
Changing that to either a property of the same name, or a non-async method works fine, of course!
I also assume this is sort of a smelly bit of functionality, but on first blush it seems like a legit need?
If I simply made the property initiate a Task that is not awaited, but then updates a backing field and then calls CanExecuteChanged... well, that's circular!
Any thoughts or ideas? @Sergio0694 it seems like perhaps the RelayCommand CanExecute could support async methods?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
How would I use an async function to update a "CanExecute" property of a RelayCommand?
The docs say a method can be used, but unfortunately an async Task method gives a build error of
"The CanExecute name must refer to a compatible member, but no valid members were found for "CanUpdate" in type foo"
Changing that to either a property of the same name, or a non-async method works fine, of course!
I also assume this is sort of a smelly bit of functionality, but on first blush it seems like a legit need?
If I simply made the property initiate a Task that is not awaited, but then updates a backing field and then calls CanExecuteChanged... well, that's circular!
Any thoughts or ideas?
@Sergio0694 it seems like perhaps the RelayCommand CanExecute could support async methods?
Beta Was this translation helpful? Give feedback.
All reactions