There is another thread, the window controls should be changed. Namely, Image and its property ToolTip. WPF Code:
<Image x:Name="IconState" HorizontalAlignment="Left" Height="25" Margin="4,10,0,0" VerticalAlignment="Top" Width="25" Source="Images/ExImage.png" Grid.RowSpan="2" ToolTip="Some Tip"/> C # code:
FFM.Dispatcher.Invoke(new ThreadStart(delegate {; FFM.IconState.ToolTip = "Example tip 2"; })); //Обновляем ToolTip BitmapImage ImageP = new BitmapImage(new Uri("/Images/ExImage2.png", UriKind.Relative)); //Объявляем изображение FFM.Dispatcher.Invoke(new ThreadStart(delegate {; FFM.IconState.Source = ImageP; })); //Меняем изображение On the last line, we have an exception: System.InvalidOperationException: "Вызывающий поток не может получить доступ к данному объекту, так как владельцем этого объекта является другой поток."
Why it happens? After all, Dispatcher.Invoke does not allow the execution of the code to go further until the response from the dispatcher comes, that is, the idea should not exist.