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

Xamarin.Forms - Triggering an IsBusy Binding

$
0
0

I have an IsBusy binding that can be activated by saying bool isBusy = true; ... or false;. However, I have realized that bool is the only place I can set IsBusy to be true/false.

Can I trigger my IsBusy binding somewhere other than at bool? I have been trying out IsBusy = true/false everywhere and reading tutorials, I'm not sure what I'm doing differently, it does not seem to update my IsBusy binding.

using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using System;
using System.ComponentModel;
using System.Windows.Input;
using Xamarin.Forms;
using Rox;

namespace PreAppStructure
{
    public class RoxViewModel : INotifyPropertyChanged
    {

        public RoxViewModel()
        {

        }

        // IsBusy be manually toggled with:  bool isBusy = true/false;

        bool isBusy;

        // Can I toggle it somewhere else?

        public event PropertyChangedEventHandler PropertyChanged;

        public bool IsBusy
        {
            get { return isBusy; }
            set
            {
                isBusy = value;
                OnPropertyChanged(nameof(IsBusy));
            }
        }


        //Property Changes

        protected void OnPropertyChanged(string propertyName)
        {
            PropertyChangedEventArgs eventArgs = new PropertyChangedEventArgs(propertyName);
            PropertyChanged?.Invoke(this, eventArgs);
        }
    }
}

Viewing all articles
Browse latest Browse all 91519

Trending Articles



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