Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

Using a CanExecute Func on a RelayCommand never re-enables a button. Is this a fault with Forms?

$
0
0
        private RelayCommand _myRelay;

        /// <summary>
        /// Gets the MyRelay.
        /// </summary>
        public RelayCommand MyRelay
        {
            get
            {
                return _myRelay
                    ?? (_myRelay = new RelayCommand(
                    () =>
                    {
                         // I can Run my relay 
:) }, () => CanMyRelayRun)); } } private Customer _canMyRelayRun; public Customer CanMyRelayRun { get { return _canMyRelayRun; } set { _canMyRelayRun = value; RaisePropertyChanged(); } }

Now if I set the boolean property to true in the code, my button never re enables.. I am using Galasofts MVVM light which I believe is a popular MVVM toolkit. I was wondering if anyone else has encountered this problem? A workaround at the moment is to bind the isenabled property of my button to the boolean CanMyRelayRun. But if I have to do this for every button this could get messy. Is this a problem with forms? Mayb the default binding on the IsEnabled property only being OneWay or something?


Viewing all articles
Browse latest Browse all 58056

Trending Articles



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