【问题标题】:Busy indicator is not displaying in wpf?wpf中没有显示忙碌指示符?
【发布时间】:2014-10-04 04:48:33
【问题描述】:

大家好,我想在我的项目中显示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");
                }
            }
        }

【问题讨论】:

  • 发布完整的 XAML 代码
  • 我已经编辑了代码并发布了完整的代码
  • @CodeSnipper,你在 xaml 代码中还有其他控件吗,把你的忙碌指示器放在布局之外
  • 我已将其放置在父网格中

标签: c# wpf backgroundworker busyindicator


【解决方案1】:

您在设置器中设置IsBusy,而不是_isBusy

应该是:

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

【讨论】:

  • 那是我的视力错误:)
猜你喜欢
  • 1970-01-01
  • 2011-09-11
  • 2018-06-18
  • 2015-08-04
  • 1970-01-01
  • 2017-05-25
  • 1970-01-01
  • 1970-01-01
  • 2015-11-28
相关资源
最近更新 更多