2014-07-15 51 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();