2014-07-15 52 views
0

我创建了一个WPF表单,其中包含来自扩展WPF工具包的BusyIndi​​cator。此窗口在新线程上运行并实现INotifyPropertyChanged。接下来,我将BusyContent绑定到在BusyContent上显示正常的属性,但似乎没有更新。有任何想法吗 ?BusyIndi​​cator BusyContent绑定到WPF窗口中的属性不会更新

<StackPanel> 
    <xctk:BusyIndicator IsBusy="True" BusyContent="{Binding BusyText, Mode=TwoWay, NotifyOnSourceUpdated=True, UpdateSourceTrigger=PropertyChanged}" > 
    </xctk:BusyIndicator> 
</StackPanel> 

private string _busyText; 
    public string BusyText 
    { 
     get 
     { 
      return _busyText; 
     } 
     set 
     { 
      _busyText = value; 
      this.OnPropertyChanged("BusyText"); 
     } 
    } 
+0

的问题是你是否阻塞UI线程。 –

+1

WPF使用“Windows”不是窗体... –

+0

因为属性在特定时间间隔发生更改,所以我不阻止UI。 – Jim

回答

0

我已经实现与后台线程的解决方案,它开始工作:

BackgroundWorker worker = new BackgroundWorker(); 
worker.DoWork += (o, ea) => 
    { 
     BusyText = ReceivedMessage; 
    }; 
worker.RunWorkerCompleted += (o, ea) => 
{ 
    _busyIndicator.IsBusy = false; 
}; 
_busyIndicator.IsBusy = true; 
worker.RunWorkerAsync();