How to change label content with timers throwing InvalidOperationException
问题 I'm making an application and I'm using a timer in that application to change label content in WPF C# .NET. In the timer's elapsed event I'm writing the following code lblTimer.Content = "hello"; but its throwing an InvalidOperationException and gives a message The calling thread cannot access this object because a different thread owns it. I'm using .NET framework 3.5 and WPF with C#. Please help me. Thanks in advance. 回答1: For .NET 4.0 it is much simpler to use a DispatcherTimer. The