繁忙的指标不显示在wpf中?

时间:2014-08-11 11:12:57

标签: c# wpf backgroundworker busyindicator

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

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

1 个答案:

答案 0 :(得分:2)

您在设置者中设置了IsBusy,而不是_isBusy

应该是:

public bool IsBusy
{
    get
    {
        return _isBusy;
    }
    set
    {
        if(value!=_isBusy)
        {
            _isBusy = value;
            OnPropertyChanged("IsBusy");
        }
    }
}