Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/xamarin/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Forms-触发IsBusy绑定_C#_Xamarin_Xamarin.forms_Binding - Fatal编程技术网

C# Forms-触发IsBusy绑定

C# Forms-触发IsBusy绑定,c#,xamarin,xamarin.forms,binding,C#,Xamarin,Xamarin.forms,Binding,我有一个IsBusy绑定,可以通过说bool IsBusy=true来激活它。。。或false。然而,我意识到,bool是我唯一可以将IsBusy设置为true/false的地方 我可以在bool以外的其他地方触发我的IsBusy绑定吗?我一直在到处试用IsBusy=true/false和阅读教程,我不确定我做了什么不同,它似乎没有更新我的IsBusy绑定 using System; using System.Collections.Generic; using System.Text; usi

我有一个
IsBusy
绑定,可以通过说
bool IsBusy=true来激活它。。。或false
。然而,我意识到,
bool
是我唯一可以将
IsBusy
设置为true/false的地方

我可以在
bool
以外的其他地方触发我的
IsBusy
绑定吗?我一直在到处试用
IsBusy=true/false
和阅读教程,我不确定我做了什么不同,它似乎没有更新我的
IsBusy
绑定

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);
        }
    }
}

您有多个选项来欺骗您的IsBusy指示灯:

  • 通过命令
  • 通过装订
  • 如果属性不是bool类型,则通过绑定和转换器
但是您需要设置IsBusy和notisbusy