1

大家好,我想Busy Indicator在我的项目中显示一个。我正在使用后台工作线程,但问题是忙碌指示器没有显示在屏幕上我不知道是什么。代码是:

XAML 是:

<xctk:BusyIndicator Width="200" HorizontalAlignment="Center" 
                    BusyContent="Please wait while the Access controller is configuring "
                    IsBusy="{Binding IsBusy}">

</xctk:BusyIndicator>

C#代码是:

BackgroundWorker _worker = new BackgroundWorker();

{
   _worker.DoWork += (o, ea) =>
    {
      IsBusy = true;
      DiscoverConnectedDevices();
    };

            _worker.RunWorkerCompleted += (o, ea) =>
                {
                    IsDiscoverButtonEnable = true;
                    IsBusy = false;
                    Mouse.OverrideCursor = null;

                    CommandManager.InvalidateRequerySuggested();
                };
            ipmac = new ObservableCollection<IpMacAddressClass>();
        }
 public bool IsBusy
        {
            get
            {
                return _isBusy;
            }
            set
            {
                if(value!=_isBusy)
                {
                    IsBusy = value;
                    OnPropertyChanged("IsBusy");
                }
            }
        }
4

1 回答 1

2

IsBusy在你的设置器中设置,而不是_isBusy

应该:

public bool IsBusy
{
    get
    {
        return _isBusy;
    }
    set
    {
        if(value!=_isBusy)
        {
            _isBusy = value;
            OnPropertyChanged("IsBusy");
        }
    }
}
于 2014-08-11T11:39:55.557 回答