我创建了一个WPF表单,其中包含来自Extended WPF Toolkit的BusyIndicator。此窗口在新线程上运行并实现INotifyPropertyChanged。接下来,我将BusyContent绑定到属性,该属性在BusyContent上显示正常,但似乎没有更新。任何想法?
<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 :(得分:0)
我已经用后台线程实现了解决方案,它开始工作了:
BackgroundWorker worker = new BackgroundWorker();
worker.DoWork += (o, ea) =>
{
BusyText = ReceivedMessage;
};
worker.RunWorkerCompleted += (o, ea) =>
{
_busyIndicator.IsBusy = false;
};
_busyIndicator.IsBusy = true;
worker.RunWorkerAsync();