0
我的應用程序有幾個後臺工作者,每個人都在做不同的工作。當我點擊「開始」按鈕時,所有背景工作人員將同時開始。關於WPF動畫的DataTrigger
在我的XAML,我已經定義我的一個旋轉圖像的動畫:
<window.Resources>
<Storyboard x:Key="imageRotate">
<DoubleAnimation Storyboard.TargetName="transRotate"
Storyboard.TargetProperty="(Image.RenderTransform).(RotateTransform.Angle)"
From="0" To="360"
Duration="0:0:0.5"
AutoReverse="False"
RepeatBehavior="Forever"/>
</Storyboard>
</window.Resources>
我希望動畫開始時,所有的BackgroundWorker的開始,停止只有當所有後臺工作停止。
我有一個屬性調用AreWorkersBusy:
private bool _areWorkerBusy;
public bool AreWorkerBusy
{
get
{
return _areWorkerBusy;
}
set
{
bool isBusy = false;
foreach(BackgroundWorker worker in BackgroundWorkerList)
{
if(worker.IsBusy)
isBusy = true;
}
_areWorkerBusy = isBusy;
}
}
但它不是DependencyProperty的,所以我不能綁定到我的動畫的DataTrigger。
任何解決方法???
幫助!