[Question] Observe Method to CanExecute ReactiveCommand #2804
-
Hi all, I'm working in WPF App and Avalonia.
In this sample : I want to bind IsValidMessage. I know that ReactiveUi use WhenAnyValue when we want to observe properties changed. Thank in advance, |
Beta Was this translation helpful? Give feedback.
Answered by
glennawatson
Jun 23, 2021
Replies: 1 comment 3 replies
-
You can do var canExecute = this.WhenAnyValue(x => x.MessageText).Select(x => x?.Length > 10) You could also use a method like var canExecute = this.WhenAnyValue(x => x.MessageText).Select(x => IsValidMessage(x));
private bool IsValidMessage(string message)
{
return message?.Length > 10;
} Also use the GitHub discussions tab in the future if you have questions rather than a issue. |
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
Tenjim
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can do
You could also use a method like
Also use the GitHub discussions tab in the future if you have questions rather than a issue.