当我更改正在显示的视图时,我正在使用WPF,Caliburn.Micro和WPF Extended Toolkit来显示忙碌指示符。问题是繁忙的指示器永远不会显示在被切换的视图之间(这就是我需要它的原因)。
破碎时的工作原理
应如何运作
ShellView(BusyIndicator代码段)
<xctk:BusyIndicator IsBusy="{Binding IsBusy}">
<ContentControl x:Name="ActiveItem" />
</xctk:BusyIndicator>
NavigationViewModel(方法 - 点击菜单项时触发)
public void NavigationItemClicked(NavigationItem item)
{
_eventAggregator.PublishOnUIThread(new NavigationItemClicked(item.ViewModelType));
}
ShellViewModel(方法 - 从NavigationViewModel.NavigationItemClicked捕获消息)
public void Handle(NavigationItemClicked message)
{
worker = new BackgroundWorker();
worker.DoWork += (s, e) =>
{
ChangeActiveItem(QuestDetails, true);
IsBusy = false;
};
IsBusy = true;
worker.RunWorkerAsync();
}
还尝试
答案 0 :(得分:0)
IsBusy =“{Binding IsBusy,UpdateSourceTrigger = PropertyChanged}”
public void Handle(NavigationItemClicked message)
{
worker = new BackgroundWorker();
worker.DoWork += (s, e) =>
{
ChangeActiveItem(QuestDetails, true);
IsBusy = false;
};
worker.RunWorkerCompleted += (s, e) =>
{
IsBusy = true;
};
worker.RunWorkerAsync();
}