i have a program that needs to change the color of a rectangle. but i'm using threads. here's what i have
mySolidColorBrush.Dispatcher.Invoke(DispatcherPriority.Send, new FillBoxColor(fillBoxColor), Colors.Green;
delegate void FillBoxColor(Colors x);
void fillBoxColor(Colors x)
{
mySolidColorBrush.Color = x;
rctIsConnected.Fill = mySolidColorBrush;
}
i always get the cannot convert system.windows.media.color to system.windows.media.colors error. any ideas?

1 answers
I think that what you want is :
answered one year ago by:
17279
237
thanks for the reply vulpes, but i tried that and i'm back to the error that the thread can't access it because it's not the same thread
17279
Well, that's a different error altogether but it makes no sense because, of course, the rationale for using Dispatcher.Invoke in the first place is to marshal UI changes back to the UI thread. Do you still get the error if you use BeginInvoke rather than Invoke?
237
when i try begininvoke, i get no errors, but it seems to just skip over the color change. tried to add a breakpoint, and it's definately running the line, but it's not changing the color.
17279
It's difficult to know what else to suggest but I'd try reducing the DispatcherPriority from Send to Normal in case that's upsetting matters.