c# - CanExecute in DelegateCommand and expression declaration doesn't work -
my question straightforward. why works: public delegatecommand logincommand { get; } func<bool> canexecutelogin = () => !stringservice.isnullorempty(_entries.logintext, _entries.passwordtext); logincommand = new delegatecommand(onlogintapped, canexecutelogin); but doesn't: public delegatecommand logincommand => new delegatecommand(onlogintapped, () => !stringservice.isnullorempty(_entries.logintext, _entries.passwordtext)); i check so: public string loginentrytext { { return _entries.logintext; } set { _entries.logintext = value; logincommand?.raisecanexecutechanged(); } } doesn't work, mean func never executes after initialization. question not entirely clear me, suspect reason follows. this public delegatecommand logincommand => new delegatecommand(...) is equivalent this public delegatecommand logincommand { {return