Quantcast
Viewing all articles
Browse latest Browse all 39

CanExecute in DelegateCommand and expression declaration doesn't work

My question is straightforward.Why this works:

public DelegateCommand LogInCommand { get; }Func<bool> canExecuteLogIn = () => !StringService.IsNullOrEmpty(_entries.LoginText, _entries.PasswordText);LogInCommand = new DelegateCommand(OnLogInTapped, canExecuteLogIn);

But this doesn't:

public DelegateCommand LogInCommand => new DelegateCommand(OnLogInTapped,            () => !StringService.IsNullOrEmpty(_entries.LoginText, _entries.PasswordText));

I check like so:

 public string LoginEntryText        {            get { return _entries.LoginText; }            set            {                _entries.LoginText = value;                LogInCommand?.RaiseCanExecuteChanged();            }        }

Doesn't work, I mean that Func never executes after initialization.


Viewing all articles
Browse latest Browse all 39

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>