-3
我已經寫了一條if語句,我已經在這裏發佈了一次,現在除了我有的顏色更改外,它正常工作。正在應用不同的變量,但沒有發生顏色變化。我認爲這也是非常簡單的事情,我不抓住它。任何援助都會很大。我可以先讓顏色發生變化,但是變量永遠不會顯示在文本塊中。textblock forground color not if with if語句
if (e.CmsData.Skill.InQueueInRing > 0)
{
Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action)(() => { callsWaitingData.Text = e.CmsData.Skill.InQueueInRing.ToString(); }));
callsWaitingData.Foreground = new SolidColorBrush(Colors.Red);
}
else if (e.CmsData.Skill.AgentsAvailable > 0)
{
Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action)(() => { callsWaitingData.Text = e.CmsData.Skill.AgentsAvailable.ToString(); }));
callsWaitingData.Foreground = new SolidColorBrush(Colors.Green);
}
else
{
callsWaitingData.Text = "0";
callsWaitingData.Foreground = new SolidColorBrush(Colors.Yellow);
}
您不應該在傳遞給'BeginInvoke'的動作中改變顏色嗎? – juharr
當我這樣做時它仍然不起作用。相同的結果 – mcavanaugh418
你是什麼意思的_「我可以讓顏色變化先發生,然後變量永遠不會顯示在文本塊中。」_ - 你的意思是顏色變化確實發生,但文本沒有更新? – PaulF